DeprecationWarning: use options instead of chrome_options error using Brave Browser With Python Selenium and Chromedriver on Windows
Asked Answered
C

2

1

I want to use Selenium (installed: ver 3.141.0.dist-info) on Python (3.8) which is installed on my Windows 7 64, I Use Brave Browser Version 1.17.73 Chromium: 87.0.4280.67 (Official Build) (64-bit) and

Chromedriver (chromedriver_win32-87.0.4280.20) for it, when running the following Py file which I got the code from here, new Brave browser opens up, but I get errors.

Any solution to make this works? Appreciate your help.

when running this file:

from selenium import webdriver
driver_path = 'C:/python/Python38/chromedriver.exe'
brave_path = 'C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'
option = webdriver.ChromeOptions()
option.binary_location = brave_path
browser = webdriver.Chrome(executable_path=driver_path, chrome_options=option)

browser.get("https://www.google.es")

get these errors:

c:/Users/mycomp/Desktop/Python/test/getwebdriver.py:12: DeprecationWarning: use options instead of 
chrome_options
browser = webdriver.Chrome(executable_path=driver_path, chrome_options=option)
[7132:3952:1127/003249.595:ERROR:os_crypt_win.cc(93)] Failed to decrypt: The parameter is incorrect. 
(0x57)
[7132:3952:1127/003249.596:ERROR:brave_sync_prefs.cc(114)] Decrypt sync seed failure

DevTools listening on ws://127.0.0.1:51576/devtools/browser/a048c130-e608-4ec6-a388-ad67fc32d97a
[1127/003250.360:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003250.452:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003250.455:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003250.457:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003250.458:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003250.711:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003250.821:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003252.062:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.
[1127/003254.498:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: 
Bad attribute.

C:\Users\mycomp\Desktop\Python\test>[1127/003304.647:ERROR:gl_surface_egl.cc(773)] EGL Driver message 
(Error) eglQueryDeviceAttribEXT: Bad attribute.

Edited:

I found a solution to this from another place, to add the following to the code, but I still get errors, fewer errors

option.add_argument('--disable-gpu')

I run it and got this error:

c:/Users/mycomp/Desktop/Python/test/getwebdriver.py:12: DeprecationWarning: 
use options instead of chrome_options
browser = webdriver.Chrome(executable_path=driver_path, 
chrome_options=option)
[6208:8532:1127/021046.062:ERROR:os_crypt_win.cc(93)] Failed to decrypt: The 
parameter is incorrect. (0x57)
[6208:8532:1127/021046.063:ERROR:brave_sync_prefs.cc(114)] Decrypt sync seed 
failure

DevTools listening on ws://127.0.0.1:53262/devtools/browser/adb0a87d-298a- 
4b9c-ad00-132a607cb9bd

%20%20browser-with-python-selenium-and-chromedriver

Colpin answered 26/11, 2020 at 21:50 Comment(0)
S
1

The key chrome_options was deprecated sometime back. Instead you have to use options and your effective code block will be:

from selenium import webdriver

driver_path = 'C:/python/Python38/chromedriver.exe'
brave_path = 'C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'
option = webdriver.ChromeOptions()
option.binary_location = brave_path
browser = webdriver.Chrome(executable_path=driver_path, options=option)

browser.get("https://www.google.es")

References

You can find a couple of relevant detailed discussion in:

Smukler answered 26/11, 2020 at 22:47 Comment(5)
thank you for the response, I tried your code, but it still throws error, I guess same error: some of them:` c:/Users/mycomp/Desktop/Python/test/getwebdriver2.py [7088:9104:1127/022037.988:ERROR:os_crypt_win.cc(93)] Failed to decrypt: The parameter is incorrect. (0x57) [7088:9104:1127/022037.990:ERROR:brave_sync_prefs.cc(114)] Decrypt sync seed failure DevTools listening on ws://127.0.0.1:53545/devtools/browser/288a869a-577c-400b-9ac7-7f318174d272 [1127/022048.029:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute.`Colpin
@Colpin os_crypt_win.cc(93)] Failed to decrypt: The parameter is incorrect. is a different error all together most possibly Brave Browser callback issue which needs further detailed investigation. I'm sure your initials error of DeprecationWarning is solved now.Smukler
I installed new version of Chrome, tried to use Selenium with the same version of webdriver, getting error on: GL Driver message (Error) 1127/130527.830:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQueryDeviceAttribEXT: Bad attribute. maybe I should use Firefox, I use Brave because it is fast, Chrome in my machine works very slowly.Colpin
I was reading a post about this Here, that if it involves invoking click() or send_keys() use some code block, but I just load a web browser to test, does it involve any of these? to use any of the code blocks? I installed python on my windows machine, does this ES2-only devices, can have anything to do with it? I thought these ES2 devices are only devices like mobile.Colpin
@Colpin I constructed that answer in the beginning of 2020 since then Chrome/ChromeDriver have got updated. No doubt Chrome/ChromeDriver combo currently fails on a couple of unharmful callbacks, but incase of Brave it seems to be having a larger impact which needs deeper analysis.Smukler
K
0

If you are now seeing WebDriver.__init__() got an unexpected keyword argument 'chrome_options', this is due to changes in selenium 4.10.0: https://github.com/SeleniumHQ/selenium/commit/9f5801c82fb3be3d5850707c46c3f8176e3ccd8e

Changes_in_selenium_4_10_0

chrome_options has been removed. Also, the driver manager is now built-in to selenium, so you no longer need to use the separate webdriver_manager. The Selenium Team talked about that here: https://www.linkedin.com/pulse/selenium-manager-best-tool-from-you-can-forget-david-burns/

Use the service and options args for passing in settings:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service()
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
# ...
driver.quit()

NOTE: Someone incorrectly closed WebDriver.__init__() got an unexpected keyword argument chrome_options as a duplicate and pointed to this page as having answers, but it's not the same question. This solution answers the question marked as a duplicate.

Kartis answered 22/7, 2023 at 22:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.