首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在使用Pyinstaller编译后通过Python自动更新ChromeDriver

问如何在使用Pyinstaller编译后通过Python自动更新ChromeDriver
EN

Stack Overflow用户
提问于 2021-02-02 22:20:07
回答 2查看 11.3K关注 0票数 3

我也曾将Chromedriver打包到我的exe包中,但正如人们所说,它经常发生变化。

因此,我尝试使用自动检查update方法,它在IDE中也像梦一样工作,但是当我使用Pyinstaller方法将代码编译为exe文件时,它就会掉下来,并且不再将更新下载到我的temp位置,在那里,我将为我的程序的剩余部分执行驱动程序。

这会是窗口吗?它现在是在一个exe文件中,如何阻止这种请求?

就像这里的更新一样,这可能是因为我不确定自动约会器提取新的色度驱动器的位置,有人知道更新时驱动程序将放在哪里吗?

EN

回答 2

Stack Overflow用户

发布于 2021-02-09 03:08:26

有一个叫做chromedriver-autoinstaller的python。它可以用于自动更新色度驱动程序,您可以使用pip install chromedriver-autoinstaller命令来安装它.

代码语言:javascript
复制
import chromedriver_autoinstaller


chromedriver_autoinstaller.install()  # Check if the current version of chromedriver exists
                                      # and if it doesn't exist, download it automatically,
                                      # then add chromedriver to path
票数 7
EN

Stack Overflow用户

发布于 2021-10-02 14:02:07

webdriver-auto-update

PyPI和GitHub中有一个名为webdriver-auto-update的包,您可以使用它来实现自动下载铬驱动程序的简单和有效的方法。

程序功能

  1. 检测计算机上的本地色度驱动程序版本,并将其与在线可用的最新版本进行比较。
  2. 最新的在线版本/发行版将在与本地版本不匹配时自动下载。

Installation:确保在您的系统中安装了Python。在终端中运行以下命令来安装:pip install webdriver-auto-update

示例

代码语言:javascript
复制
from selenium import webdriver
from webdriver_auto_update import check_driver


# Pass in the folder used for storing/downloading chromedriver
check_driver('folder/path/of/your/chromedriver')

driver = webdriver.Chrome()
driver.get("http://www.python.org")

参考链接:

https://pypi.org/project/webdriver-auto-update/ https://github.com/competencytestlvl/webdriver_auto_update

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66018451

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档