如何在 Windows 上使用 Selenium 和 Python 启动 AVG Secure Browser 会话

How to initiate AVG Secure Browser session using Selenium and Python on Windows

我使用 AVG 的 Secure Browser 来搜索网络。我想用 selenium 包编写一个 python 脚本,但我不使用 Chrome、Firefox 或其他流行的。有没有办法告诉 selenium 我想使用哪个浏览器,方法是 在我的机器上显示浏览器位于 的路径?

我目前使用的浏览器位于:

C:\Program Files (x86)\AVG\Browser\Application\AVGBrowser.exe

在我的系统上。浏览器的行为类似于 Chrome 并使用 Chrome Web Store 下载 extensions

关于设置:

AVG Secure Browser is made possible by the Chromium open source project and other open source software.

由于 AVG Secure Browser 使用 Chromium 引擎,您只需传递 绝对路径 AVG Secure Browser二进制通过binary_location属性的ChromeOptions如下:

from selenium import webdriver

option = webdriver.ChromeOptions()
option.binary_location = r'C:\Program Files (x86)\AVG\Browser\Application\AVGBrowser.exe'
driver = webdriver.Chrome(executable_path=r'C:\WebDrivers\chromedriver.exe', options=option)
driver.get("https://www.google.com")

参考

您可以在以下位置找到一些相关讨论:

  • How to initiate Brave browser using Selenium and Python on Windows