Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aheadintime/playwright-firefox-addons
use firefox addons with playwright automation
https://github.com/aheadintime/playwright-firefox-addons
automation browser-automation firefox geckordp playwright playwright-python
Last synced: about 5 hours ago
JSON representation
use firefox addons with playwright automation
- Host: GitHub
- URL: https://github.com/aheadintime/playwright-firefox-addons
- Owner: aheadintime
- Created: 2023-01-04T17:01:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-05T06:12:09.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T18:31:51.846Z (3 months ago)
- Topics: automation, browser-automation, firefox, geckordp, playwright, playwright-python
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Use firefox addons inside playwright
## Tools needed
* Playwright (https://playwright.dev)
* Python (https://www.python.org)
* geckordp (https://jpramosi.github.io/geckordp/)## How to do
Use **Playwright** to create a firefox browser instance. Make sure to specify "--start-debugger-server" to allow **geckordp** to connect.
```python
browser = playwright.firefox.launch(headless=False, args=["--start-debugger-server", str(debug_port)])
```Use **geckordp** *RDPClient* to connect to launched browser instance
```python
client = RDPClient(60)
client.connect("localhost", debug_port)
```Get *AddonsActor* from *RootActor* from connected *RDPClient*
```python
root = RootActor(client)
root_actor_ids = root.get_root()addon_actor_id = root_actor_ids["addonsActor"]
addon_actor = AddonsActor(client, addon_actor_id)
```Use *install_temporary_addon* to perform xpi addon installation
```python
response = addon_actor.install_temporary_addon(addon_path)
addon_id = response.get("id", None)
```If *addon_id* is not *None* addon was installed succesfully
```python
installed = not (addon_id is None)
```**Have fun!**