简体   繁体   English

如何在Linux中通过Selenium ChromeDriver和Python打开Chromium浏览器

[英]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浏览器具有以下不同版本:

  • Chrome Canary 铬金丝雀
  • Chrome from Dev Channel 来自Dev Channel的 Chrome
  • Raw build of Chromium for Windows x64 适用于Windows x64Chromium的原始版本

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()类的实例使用ChromeOptionsbinary_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: 浏览器快照:

Chrome_Canary


trivia 琐事

You need to download the latest Chromium binary from either of the official repositories: 您需要从以下两个官方资料库中下载最新的Chromium二进制文件:

暂无
暂无

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

相关问题 在 Linux 上使用 selenium chromedriver 和 python with chromium - Using selenium chromedriver and python with chromium on Linux 如何通过Selenium在嵌入式Linux上使用铬 - How to use chromium on embedded linux through Selenium 如何通过Chromedriver和Selenium启动Chrome浏览器 - How to start Chrome Browser through Chromedriver and Selenium 如何在 Chrome 浏览器通过 Python selenium 自动更新时使用特定版本的 ChromeDriver - How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium 如何使用 Python 在通过 Selenium 和 ChromeDriver 启动的 Brave 浏览器中抑制产品分析通知栏 - How to suppress the product analytics notification bar within Brave Browser initiated through Selenium and ChromeDriver using Python 如何使用Selenium Python chromedriver在新标签页中循环浏览多个URL并打开URL - How to loop through multiple url and open urls in new tabs using selenium python chromedriver 如何配置 ChromeDriver 以通过 Selenium 在 Headless 模式下启动 Chrome 浏览器? - How to configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium? 如何使用 Selenium 和 Python 启动基于 Chromium 的 Vivaldi 浏览器 session - How to initiate a Chromium based Vivaldi browser session using Selenium and Python 如何使用带有 python、selenium 和 chromedriver 的 Brave 网络浏览器? - How to use Brave web browser with python, selenium and chromedriver? Selenium ChromeDriver无法识别新编译的Headless Chromium(Python) - Selenium ChromeDriver does not recognize newly compiled Headless Chromium (Python)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM