Skip to content

Commit 46ab1fa

Browse files
committed
FIX: Undetected chrome restart options and instance
1 parent c6d43c4 commit 46ab1fa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

botcity/web/bot.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,21 @@ def check_driver():
260260
self.capabilities = cap
261261
driver_path = self.driver_path or check_driver()
262262
self.driver_path = driver_path
263-
self._driver = self._instance_driver(driver_class=driver_class)
263+
self._driver = self._instance_driver(driver_class=driver_class, func_def_options=func_def_options)
264264
self._others_configurations()
265265
self.set_screen_resolution()
266266

267-
def _instance_driver(self, driver_class):
268-
parameters = self._get_parameters_to_driver()
267+
def _instance_driver(self, driver_class, func_def_options):
269268
try:
270-
driver = driver_class(**parameters)
269+
driver = driver_class(**self._get_parameters_to_driver())
271270
except WebDriverException as error:
272271
if 'This version of ChromeDriver only supports Chrome version' in error.msg:
273272
try:
274273
correct_version = int(error.msg.split('Current browser version is ')[1].split('.')[0])
275274
except Exception:
276275
raise error
277-
parameters["version_main"] = correct_version
278-
driver = driver_class(**parameters)
276+
self.options = func_def_options(self.headless, self._download_folder_path, None, self.page_load_strategy)
277+
driver = driver_class(**self._get_parameters_to_driver(), version_main=correct_version)
279278
else:
280279
raise error
281280
return driver

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def download_driver(request):
118118
browser = request.config.getoption("--browser") or Browser.CHROME
119119
manager = factory_driver_manager(browser=browser)
120120
installed_driver = manager(path=folder_driver).install()
121-
print(installed_driver)
121+
122122
yield installed_driver
123123
# Issue: https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/551
124124
if platforms.get(platform.system()) == "windows" and browser == Browser.UNDETECTED_CHROME:

0 commit comments

Comments
 (0)