带chromium浏览器的Selenium Python(windows)
我正在尝试在windows 8上启动带有selenium python的chromium浏览器 添加了带chromium浏览器的Selenium Python(windows),python,google-chrome,selenium,selenium-chromedriver,chromium,Python,Google Chrome,Selenium,Selenium Chromedriver,Chromium,我正在尝试在windows 8上启动带有selenium python的chromium浏览器 添加了二进制位置作为二进制位置,即appdata。 但chromedriver仍然启动了google chrome而不是chrome 如果我卸载google chrome,chromedriver默认启动chrome。但安装了chrome之后,它总是会发布chrome 有人知道如何在安装chrome的同时使用selenium启动chrome吗 请不要将其标记为重复。另一个是关于unix和为seleni
二进制位置
作为二进制位置,即appdata。
但chromedriver仍然启动了google chrome而不是chrome
如果我卸载google chrome,chromedriver默认启动chrome。但安装了chrome之后,它总是会发布chrome
有人知道如何在安装chrome的同时使用selenium启动chrome吗
请不要将其标记为重复。另一个是关于unix和为selenium java提供的解决方案,而这一个是关于windows和python的。试试这个:
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = r"D:\.....\chrome.exe"
# This line defines your Chromium exe file location.
driver = webdriver.Chrome(chrome_options=options)
driver.get('https://www.google.com/')
为我工作。
我安装了Chrome和Chrome。
它启动指定的exe。要启动Chromium浏览器,可以使用以下代码块:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location("C:\\path\\to\\chrome.exe") //path to chromium binary
options.add_argument("start-maximized")
options.add_argument("--disable-gpu-vsync") //only for Windows
options.add_argument("--remote-debugging-port=9222") //for MAC & Linux
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
driver.get('http://google.com/')
注意:在这里您可以找到有关
您的机器上是否安装了google chrome?因为如果我并行安装chrome,这对我不起作用。它启动了chrome。@VaspandiNallasamy是的,我都安装了。Chrome在“C:\Program Files(x86)\Google\Chrome\Application\Chrome.exe”中,Chrome在“C:\Users\mingchau\AppData\Local\Chrome\Application\Chrome.exe”中找到了罪魁祸首,最新的chromedriver就是问题所在。使用chromedriver 2.36和chromedriver 65进行测试。接受你的答案。@VaspandiNallasamy你为什么接受一个与你如何解决问题完全无关的答案?chrome_options key是一个不推荐使用的选项参数,如。使用所需的功能,而不是代替感谢人,它的工作与旧版本的chromedriver@VaspandiNallasamy如果我的答案符合你的问题,请点击我答案旁边的勾号接受答案,该勾号位于Votedown箭头下方,因此勾号变为绿色。