Selenium 如何将chromedriver添加到我的github存储库
基本上,我想学习如何将chromedriver添加到github repo中,以便人们可以在他们的应用程序上运行我的python脚本 我已经下载了chromedriver for linux,并通过本地路径执行它 我看到人们正在将chromedriver_安装程序添加到他们的requirements.txt中,但用户必须手动更改脚本以添加安装chromedriver的路径。有没有一种方法可以自动做到这一点 那么,将其添加到我的项目中并使其能够在每台机器上工作的最佳方法是什么呢?我喜欢使用。它非常简单,只需使用pip安装,您就可以像这样在代码中使用它,而无需实际安装chromedriver/将其推送到您的repoSelenium 如何将chromedriver添加到我的github存储库,selenium,github,selenium-chromedriver,Selenium,Github,Selenium Chromedriver,基本上,我想学习如何将chromedriver添加到github repo中,以便人们可以在他们的应用程序上运行我的python脚本 我已经下载了chromedriver for linux,并通过本地路径执行它 我看到人们正在将chromedriver_安装程序添加到他们的requirements.txt中,但用户必须手动更改脚本以添加安装chromedriver的路径。有没有一种方法可以自动做到这一点 那么,将其添加到我的项目中并使其能够在每台机器上工作的最佳方法是什么呢?我喜欢使用。它非常
from selenium import webdriver
import chromedriver_autoinstaller
chromedriver_autoinstaller.install()
#Chrome options
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument('--disable-dev-shm-usage')
#Run chrome
driver = webdriver.Chrome(options=chrome_options)
# do the code for your test
将其添加为资源,并在运行时提取(如果不存在)。请记住检查/设置权限。另一种方法是让webdrivermanager下载/安装: