Merge branch 'playwright' of https://github.com/weeix/changedetection.io into playwright

pull/489/head
dgtlmoon 3 years ago
commit 8ce75f40d9

@ -20,6 +20,11 @@ COPY requirements.txt /requirements.txt
RUN pip install --target=/dependencies -r /requirements.txt
# Playwright is an alternative to Selenium
# Excluded this package from requirements.txt to prevent arm/v6 and arm/v7 builds from failing
RUN pip install --target=/dependencies playwright~=1.20 \
|| echo "WARN: Failed to install Playwright. The application can still run, but the Playwright option will be disabled."
# Final image stage
FROM python:3.8-slim

@ -23,7 +23,7 @@ class Fetcher():
content = None
headers = None
# Will be needed in the future by the VisualSelector, always get this where possible.
screenshot = None
screenshot = False
fetcher_description = "No description"
@abstractmethod
@ -80,6 +80,11 @@ class base_html_playwright(Fetcher):
if os.getenv("PLAYWRIGHT_DRIVER_URL"):
fetcher_description += " via '{}'".format(os.getenv("PLAYWRIGHT_DRIVER_URL"))
# try:
# from playwright.sync_api import sync_playwright
# except ModuleNotFoundError:
# fetcher_enabled = False
browser_type = ''
command_executor = ''
@ -94,7 +99,7 @@ class base_html_playwright(Fetcher):
self.browser_type = os.getenv("PLAYWRIGHT_BROWSER_TYPE", 'chromium').strip('"')
self.command_executor = os.getenv(
"PLAYWRIGHT_DRIVER_URL",
'ws://playwright-server:4444/playwright'
'ws://playwright-chrome:3000/playwright'
).strip('"')
# If any proxy settings are enabled, then we should setup the proxy object

@ -24,11 +24,7 @@ services:
# https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.proxy
#
# Alternative Playwright URL, do not use "'s or 's!
# - PLAYWRIGHT_DRIVER_URL=ws://playwright-server:4444/playwright
#
# Alternative Playwright Browser Type, must match with PLAYWRIGHT_BROWSER_TYPE in the playwright-server service
# See https://playwright.dev/docs/browsers
# - PLAYWRIGHT_BROWSER_TYPE=chromium
# - PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000/playwright
#
# Playwright proxy settings playwright_proxy_server, playwright_proxy_bypass, playwright_proxy_username, playwright_proxy_password
#
@ -71,17 +67,11 @@ services:
# - /dev/shm:/dev/shm
# restart: unless-stopped
# playwright-server:
# hostname: playwright-server
# build: ./playwright
# environment:
# - PLAYWRIGHT_PORT=4444
# # Must match with PLAYWRIGHT_BROWSER_TYPE in the changedetection service
# - PLAYWRIGHT_BROWSER_TYPE=chromium
# ipc: host
# user: pwuser
# security_opt:
# - seccomp:./playwright/seccomp_profile.json
# Used for fetching pages via Playwright+Chrome where you need Javascript support.
# playwright-chrome:
# hostname: playwright-chrome
# image: browserless/chrome
# restart: unless-stopped
volumes:

Loading…
Cancel
Save