弃用警告:在Windows上使用带有Python Selenium和Chromedriver的Brave浏览器时,使用选项而不是chrome\u选项错误

弃用警告:在Windows上使用带有Python Selenium和Chromedriver的Brave浏览器时,使用选项而不是chrome\u选项错误,python,selenium,selenium-webdriver,selenium-chromedriver,brave-browser,Python,Selenium,Selenium Webdriver,Selenium Chromedriver,Brave Browser,我想在安装在Windows764上的Python(3.8)上使用Selenium(已安装:ver3.141.0.dist-info), 我使用的是Brave浏览器版本1.17.73 Chromium:87.0.4280.67(官方版本)(64位) 及 Chromedriver(Chromedriver_win32-87.0.4280.20)用于it, 当运行我从中获取代码的以下Py文件时,新的Brave浏览器会打开,但我会遇到错误 有什么办法可以让这一切顺利进行吗? 谢谢你的帮助 运行此文件时:

我想在安装在Windows764上的Python(3.8)上使用Selenium(已安装:ver3.141.0.dist-info), 我使用的是Brave浏览器版本1.17.73 Chromium:87.0.4280.67(官方版本)(64位) 及

Chromedriver(Chromedriver_win32-87.0.4280.20)用于it, 当运行我从中获取代码的以下Py文件时,新的Brave浏览器会打开,但我会遇到错误

有什么办法可以让这一切顺利进行吗? 谢谢你的帮助

运行此文件时:

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")
获取以下错误:

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.
编辑:

我从另一个地方找到了解决这个问题的方法,在代码中添加了以下内容,但是我仍然得到了错误,更少的错误

option.add_argument('--disable-gpu')
我运行它并得到了以下错误:

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%20带有python selenium和chromedriver的浏览器

早在某个时候,chrome_选项的键
就被弃用了。相反,您必须使用
选项
,您的有效代码块将是:

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")

工具书类 您可以在以下内容中找到一些相关的详细讨论:


感谢您的回复,我尝试了您的代码,但它仍然抛出错误,我猜是相同的错误:其中一些:`c:/Users/mycop/Desktop/Python/test/getwebdriver2.py[7088:9104:1127/022037.988:error:os_crypt_win.cc(93)]解密失败:参数不正确。(0x57)[7088:9104:1127/022037.990:ERROR:brave_sync_prefs.cc(114)]解密同步种子失败DevTools侦听ws://127.0.0.1:53545/DevTools/browser/288a869a-577c-400b-9ac7-7f318174d272[1127/022048.029:ERROR:gl surface_egl.cc(773)]egl驱动程序消息(ERROR)eglQueryDeviceAttribEXT:Bad属性错误。`@Dave99
win.cc(93)]解密失败:参数不正确。
是一个不同的错误,可能是浏览器回调问题,需要进一步详细调查。我确信您的
弃用警告
的首字母缩写错误现在已解决。@Dave99如果我的答案符合您的问题,请单击我答案旁边的空心复选标记(位于votedown箭头下方),以获得答案,因此复选标记变为绿色。我安装了新版本的Chrome,尝试将Selenium与同一版本的webdriver一起使用,出现以下错误:
GL Driver message(error)
1127/130527.830:error:GL\u surface\u egl.cc(773)]egl Driver message(error)eglQueryDeviceAttribEXT:Bad属性。
也许我应该使用Firefox,我使用Brave,因为它很快,我的机器中的Chrome运行非常慢。我在读一篇关于这方面的文章,如果它涉及调用click()或send_keys(),请使用一些代码块,但我只是加载一个web浏览器进行测试,它是否涉及其中任何一个?要使用任何代码块?我在我的windows机器上安装了python,这是否与ES2专用设备有关?我认为这些ES2设备只是像移动设备一样的设备。