Code: Select all
from selenium.webdriver.chrome import service as OperaService
from selenium.webdriver.chrome.options import Options as OperaOptions
from webdriver_manager.opera import OperaDriverManager
# ...
# https://github.com/SergeyPirogov/webdriver_manager?tab=readme-ov-file#use-with-opera
driver_path = OperaDriverManager().install()
service = OperaService.Service(driver_path)
options = webdriver.ChromeOptions()
service.start()
options.add_experimental_option('w3c', True)
self._add_options(options)
self.driver = webdriver.Remote(service.service_url, options=options)
Code: Select all
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
Browserversion: 116.0.5366.21.
Windows 11 Version 23H2.
Selenium 4.25.0.
Python 3.10.11.
Verwendet Optionen:
Code: Select all
# disable logging
options_class.add_experimental_option("excludeSwitches", ["enable-logging"])
options_class.add_argument("--log-level=3")
# customize GUI
if self.headless:
options_class.add_argument('--headless=old')
options_class.add_argument('--window-size=1920,1080')
# making browser faster and reduce possible errors
options_class.add_argument("--disable-extensions")
options_class.add_argument("--no-sandbox")
options_class.add_argument('--no-first-run')
options_class.add_argument('--no-default-browser-check')
options_class.add_argument('--disable-notifications')
# hide any automation fingerprints
options_class.add_experimental_option("useAutomationExtension", False)
options_class.add_experimental_option("excludeSwitches",["enable-automation"])