【问题标题】:How to initiate AVG Secure Browser session using Selenium and Python on Windows如何在 Windows 上使用 Selenium 和 Python 启动 AVG Secure Browser 会话
【发布时间】:2020-06-30 21:50:24
【问题描述】:

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

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

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

在我的系统上。浏览器的行为类似于 Chrome 并使用 Chrome 网上应用店下载扩展程序

关于设置:

Chromium 开源项目和其他开源软件使 AVG Secure Browser 成为可能。

【问题讨论】:

    标签: python-3.x selenium selenium-webdriver webdriver chromium


    【解决方案1】:

    由于 AVG Secure Browser 使用 Chromium 引擎,您只需将 AVG Secure Browser 二进制文件的绝对路径传递给ChromeOptionsbinary_location 属性如下:

    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")
    

    参考

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

    【讨论】:

    • @t0mas 这似乎是一个不同的用例。请您对您的新要求提出一个新问题吗?
    • 谢谢!我现在有正确的浏览器工作。但我添加了driver.quit() 函数,但它并没有关闭窗口。它只是给了我一个错误。 Message: Service C:\Program Files (x86)\AVG\Browser\Application\AVGBrowser.exe unexpectedly exited. Status code was: 0
    猜你喜欢
    • 1970-01-01
    • 2020-10-18
    • 1970-01-01
    • 1970-01-01
    • 2020-04-25
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    相关资源
    最近更新 更多