-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use option 'add_experimental_option' #338
Comments
please |
I'm trying to get this working too |
@Dzeri96 @xiaoguren I have the same problem, did you solve it please? |
@luolongfei Unfortunately not, I just reverted to the older version of the driver |
i have the same problem please help me i cant use normal chromedriver because it detects me but with this driver i had no problem just cant set preferences |
Anybody figure this out yet? 🙂 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use option 'add_experimental_option'
it will exception
below my code
import undetected_chromedriver.v2 as uc
#Chrome Options
chrome_options = uc.ChromeOptions()
#Trying to set preferences for cookies (Found this from the following stackoverflow post: https://stackoverflow.com/questions/48667852/how-to-change-allow-sites-to-save-and-read-cookie-data-recommended-and-or-bloc/67260066#67260066)
prefs = {"profile.default_content_setting_values.cookies": 1, "profile.cookie_controls_mode": 0}
chrome_options.add_experimental_option("prefs", prefs)
#Initializes driver
driver = uc.Chrome(options=chrome_options)
#Navigates to website to check if cookies enabled
driver.get("https://www.whatismybrowser.com/detect/are-cookies-enabled")
#Prints true if cookies enabled and false if disabled
print(driver.find_element_by_id("detected_value").text=="Yes")
driver.close()
crash info
Traceback (most recent call last):
File "D:/WebAutoTest/others/test.py", line 8, in
driver = uc.Chrome(options=chrome_options)
File "D:\WebAutoTest\venv\lib\site-packages\undetected_chromedriver\v2.py", line 302, in init
super(Chrome, self).init(
File "D:\WebAutoTest\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in init
super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "D:\WebAutoTest\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in init
RemoteWebDriver.init(
File "D:\WebAutoTest\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 248, in init
self.start_session(capabilities, browser_profile)
File "D:\WebAutoTest\venv\lib\site-packages\undetected_chromedriver\v2.py", line 577, in start_session
super(Chrome, self).start_session(capabilities, browser_profile)
File "D:\WebAutoTest\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 339, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "D:\WebAutoTest\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 400, in execute
self.error_handler.check_response(response)
File "D:\WebAutoTest\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 236, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: goog:chromeOptions
from invalid argument: unrecognized chrome option: prefs
Stacktrace:
Backtrace:
Ordinal0 [0x006ABDE3+2473443]
Ordinal0 [0x00646661+2057825]
Ordinal0 [0x00552438+1057848]
Ordinal0 [0x00566C38+1141816]
Ordinal0 [0x00569554+1152340]
Ordinal0 [0x005637E2+1128418]
Ordinal0 [0x005989C3+1345987]
Ordinal0 [0x0059861C+1345052]
Ordinal0 [0x005998C5+1349829]
Ordinal0 [0x0059974A+1349450]
Ordinal0 [0x005955AB+1332651]
Ordinal0 [0x00572104+1188100]
Ordinal0 [0x00572F59+1191769]
GetHandleVerifier [0x00832266+1549718]
GetHandleVerifier [0x008DD4A7+2250711]
GetHandleVerifier [0x0073718B+521403]
GetHandleVerifier [0x00736229+517465]
Ordinal0 [0x0064B79D+2078621]
Ordinal0 [0x0064FB58+2095960]
Ordinal0 [0x0064FC92+2096274]
Ordinal0 [0x00659541+2135361]
BaseThreadInitThunk [0x769E6359+25]
RtlGetAppContainerNamedObjectPath [0x77528944+228]
RtlGetAppContainerNamedObjectPath [0x77528914+180]
The text was updated successfully, but these errors were encountered: