Skip to content

Commit b3e9f69

Browse files
committed
tweak defaults
1 parent 0e8c173 commit b3e9f69

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

changedetectionio/tests/restock/test_restock.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ def get_browser_fetcher_backend():
1616
one (supports screenshots + visual-selector xpath data) if one is actually usable
1717
here, otherwise None.
1818
19-
"Usable" means both: a fetcher class advertising browser capabilities is registered,
20-
AND a browser driver is configured in the environment to connect to. Without a driver
21-
the class still reports the capability but can't actually fetch.
19+
"Usable" means all of: a fetcher class advertising browser capabilities is registered,
20+
a browser driver is configured in the environment to connect to (without one the class
21+
still reports the capability but can't actually fetch), AND the engine is directly
22+
selectable (ready_to_use) rather than a base-only engine like html_playwright_builtin,
23+
which is a template for the "Add variation" flow and can't be set as the default browser.
2224
"""
2325
if not (os.getenv('PLAYWRIGHT_DRIVER_URL') or os.getenv('WEBDRIVER_URL')):
2426
return None
@@ -27,7 +29,10 @@ def get_browser_fetcher_backend():
2729
from changedetectionio.content_fetchers.base import FetcherCapabilities
2830

2931
for name, _description in content_fetchers.available_fetchers():
30-
caps = FetcherCapabilities.from_fetcher(getattr(content_fetchers, name, None))
32+
cls = getattr(content_fetchers, name, None)
33+
if cls is None or not getattr(cls, 'ready_to_use', True):
34+
continue
35+
caps = FetcherCapabilities.from_fetcher(cls)
3136
if caps.supports_screenshots and caps.supports_xpath_element_data:
3237
return name
3338

0 commit comments

Comments
 (0)