fix adblock plus not work.

master
CHUN YU YAO 2022-11-22 04:21:00 +08:00
parent 6eb00cfcdc
commit 42437ff966
1 changed files with 3 additions and 2 deletions

View File

@ -205,7 +205,7 @@ def load_chromdriver_uc(webdriver_path, adblock_plus_enable):
#driver = uc.Chrome(service=chrome_service, options=options, suppress_welcome=False) #driver = uc.Chrome(service=chrome_service, options=options, suppress_welcome=False)
is_local_chrome_browser_lower = False is_local_chrome_browser_lower = False
try: try:
driver = uc.Chrome(executable_path=chromedriver_path, desired_capabilities=caps, suppress_welcome=False) driver = uc.Chrome(executable_path=chromedriver_path, options=options, desired_capabilities=caps, suppress_welcome=False)
except Exception as exc: except Exception as exc:
if "cannot connect to chrome" in str(exc): if "cannot connect to chrome" in str(exc):
if "This version of ChromeDriver only supports Chrome version" in str(exc): if "This version of ChromeDriver only supports Chrome version" in str(exc):
@ -220,7 +220,7 @@ def load_chromdriver_uc(webdriver_path, adblock_plus_enable):
else: else:
print("Oops! web driver not on path:",chromedriver_path ) print("Oops! web driver not on path:",chromedriver_path )
print('let uc automatically download chromedriver.') print('let uc automatically download chromedriver.')
driver = uc.Chrome(desired_capabilities=caps, suppress_welcome=False) driver = uc.Chrome(options=options, desired_capabilities=caps, suppress_welcome=False)
if driver is None: if driver is None:
print("create web drive object fail!") print("create web drive object fail!")
@ -426,6 +426,7 @@ def get_driver_by_config(config_dict, driver_type):
print("platform.system().lower():", platform.system().lower()) print("platform.system().lower():", platform.system().lower())
adblock_plus_enable = config_dict["advanced"]["adblock_plus_enable"] adblock_plus_enable = config_dict["advanced"]["adblock_plus_enable"]
print("adblock_plus_enable:", adblock_plus_enable)
if browser == "chrome": if browser == "chrome":
# method 6: Selenium Stealth # method 6: Selenium Stealth