python - 如何使用 python 使用勇敢的浏览器启动 selenium web 驱动程序
问题描述
我的铬版本是 87.0.4280.88
我的勇敢浏览器版本是87.0.4280.101
我尝试了很多代码,但它们没有用。
代码:
from selenium import webdriver
option = webdriver.ChromeOptions()
option.binary_location = r'C:\Program Files (x86)\BraveSoftware\Brave-
Browser\Application\brave.exe'
driver = webdriver.Chrome(
executable_path=r'C:\WebDrivers\chromedriver.exe', options=option)
driver.get("https://www.google.com")
错误回溯:
Traceback (most recent call last):
File "c:\Users\MOHSEN\Desktop\test\Untitled-1.py", line 5, in <module>
driver = webdriver.Chrome(
TypeError: __init__() got an unexpected keyword argument 'options'
解决方案
要使用Selenium驱动的WebDriver启动勇敢的 浏览会话,您可以使用以下解决方案:
代码块:
from selenium import webdriver option = webdriver.ChromeOptions() option.binary_location = r'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe' driver = webdriver.Chrome(executable_path=r'C:\WebDrivers\chromedriver.exe', options=option) driver.get("https://www.google.com")
浏览器快照:
推荐阅读
- python - Pandas 基于事件的数据(数据科学)
- machine-learning - 如何在 python 上播放音频而不保存音频文件
- haskell - 如何使用 Haskell 中的数据构造函数?
- c++ - 引用成员绑定到一个临时对象,其生命周期将短于构造对象的生命周期
- python - 我在使用 pygmo 软件时遇到问题
- svg - 在 d3.js 中获取多条路径的质心
- c++ - /mingw32/bin/ld.exe:无法打开输出文件 HelloWorld.exe:权限被拒绝 collect2.exe:错误:ld 返回 1 退出状态
- python - MatrixInstruction 在 kivy 中不起作用
- css - django中的可变英雄图像
- asp.net - Telerik 报告中出现错误,显示无法获取报告参数。发生了错误