简体   繁体   English

弃用警告:在 Python Selenium 和 Windows 上使用 Brave 浏览器时使用选项而不是 chrome_options 错误

[英]DeprecationWarning: use options instead of chrome_options error using Brave Browser With Python Selenium and Chromedriver on Windows

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 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 -位)和

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. Chromedriver(chromedriver_win32-87.0.4280.20),当运行我从这里获取代码的以下 Py 文件时,新的 Brave 浏览器打开,但出现错误。

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 %20%20browser-with-python-selenium-and-chromedriver

The key chrome_options was deprecated sometime back.chrome_options在某个时候被弃用了。 Instead you have to use options and your effective code block will be:相反,您必须使用options ,您的有效代码块将是:

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:您可以在以下位置找到一些相关的详细讨论:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 弃用警告:在 Windows 10 系统上通过 Selenium 使用 ChromeDriver 和 Chrome 使用选项而不是 chrome_options 错误 - DeprecationWarning: use options instead of chrome_options error using ChromeDriver and Chrome through Selenium on Windows 10 system 如何使用带有 python、selenium 和 chromedriver 的 Brave 网络浏览器? - How to use Brave web browser with python, selenium and chromedriver? Chrome_Options 参数检查 - Chrome_Options Argument Check 使用Selenium ChromeDriver中的ChromeOptions和通过Python的Chrome,“选项”对象没有属性“ set_preference”错误 - 'Options' object has no attribute 'set_preference' error using ChromeOptions in Selenium ChromeDriver and Chrome through Python 如何在 Windows 上使用 Selenium 和 Python 启动 Brave 浏览器 - How to initiate Brave browser using Selenium and Python on Windows 如何使用 Python 在通过 Selenium 和 ChromeDriver 启动的 Brave 浏览器中抑制产品分析通知栏 - How to suppress the product analytics notification bar within Brave Browser initiated through Selenium and ChromeDriver using Python 如何使用 Google Chrome 而不是 Chromedriver Python Selenium - How do I use Google Chrome instead of Chromedriver Python Selenium 如何使用 selenium 镀铬选项? - How to use selenium chrome options? 无头Chrome浏览器-使用Selenium和ChromeDriver - Headless Chrome Browser - Using Selenium and ChromeDriver 将 Selenium 与用 Python 编写的 Brave Browser 传递服务对象一起使用 - Use Selenium with Brave Browser pass service object written in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM