[英]How to open Chromium Browser through Selenium ChromeDriver and Python in Linux
I have a question. 我有个问题。 I use a chromedriver of course, when I start my test, pycharm open Chromium, I would like to open Chrome, how I can change this ? 我当然使用chromedriver,当我开始测试时,pycharm打开Chromium,我想打开Chrome,该如何更改? Maybe I can set this in my code? 也许我可以在代码中设置它?
def setUp(self)
self.driver = webdriver.Chrome(chrome_options=chrome_options)
self.driver.get("site")
Chromium Browser have different version as follows: Chromium浏览器具有以下不同版本:
Not sure which Chromium Browser version you are trying to use. 不确定您要使用哪个Chromium浏览器版本。
However to use Chrome Canary version you can use the ChromeOptions and binary_location
property through an instance of Options()
class to set the absolute path of the Chrome Canary binary and you can use the following solution: 但是,要使用Chrome Canary版本,您可以通过Options()
类的实例使用ChromeOptions和binary_location
属性来设置Chrome Canary二进制文件的绝对路径 ,并且可以使用以下解决方案:
Code Block: 代码块:
from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_argument("start-maximized") options.binary_location="C:\\\\Users\\\\AtechM_03\\\\AppData\\\\Local\\\\Google\\\\Chrome SxS\\\\Application\\\\chrome.exe" driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\\Utility\\BrowserDrivers\\chromedriver.exe') driver.get('http://google.com/')
Browser Snapshot: 浏览器快照:
You need to download the latest Chromium binary from either of the official repositories: 您需要从以下两个官方资料库中下载最新的Chromium二进制文件:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.