Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Job-specific optional keys:
- ``useragent``: ``User-Agent`` header used for requests (otherwise browser default is used)
- ``browser``: Either ``chromium``, ``chrome``, ``chrome-beta``, ``msedge``,
``msedge-beta``, ``msedge-dev``, ``firefox``, ``webkit`` (must be installed with ``playwright install``)
- ``executable_path``: Path to a custom browser executable to launch instead of the
bundled Playwright build (for example a specific Firefox build); combine with ``browser``
- ``ignore_http_error_codes``: List of HTTP errors to ignore (see :ref:`advanced_topics`)

Because this job uses Playwright_ to
Expand Down
5 changes: 3 additions & 2 deletions lib/urlwatch/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class BrowserJob(Job):

__required__ = ('navigate',)

__optional__ = ('wait_until', 'wait_for', 'useragent', 'browser', 'ignore_http_error_codes')
__optional__ = ('wait_until', 'wait_for', 'useragent', 'browser', 'executable_path', 'ignore_http_error_codes')

def get_location(self):
return self.user_visible_url or self.navigate
Expand All @@ -446,7 +446,8 @@ def set_base_location(self, location):
def retrieve(self, job_state):
from playwright.sync_api import sync_playwright
with sync_playwright() as playwright:
browser = playwright[self.browser or "chromium"].launch()
launch_kwargs = {'executable_path': self.executable_path} if self.executable_path else {}
browser = playwright[self.browser or "chromium"].launch(**launch_kwargs)
page = browser.new_page(user_agent=self.useragent)

if self.wait_until in ('networkidle0', 'networkidle2'):
Expand Down
Loading