python模块和cli工具,用于方便下载和部署webdriver二进制文件。
webdriverdownloader的Python项目详细描述
python模块,以便于下载和部署WebDriver二进制文件。此模块中的类可用于自动搜索和下载最新版本(或特定版本)的WebDriver二进制文件(如果使用^{TT3}$运行,则将下载到^{TT1}$或^{TT2}$),从下载的存档文件中提取二进制文件并在^{TT4}$(如果使用^{TT3}$运行)或^{TT6}$中创建符号链接。
安装
此模块位于python包索引(pypi)上,可以按如下方式安装:
pip install webdriverdownloader
课程
提供以下课程:
- ChromeDriverDownloader用于下载和安装chromedriver(用于google chrome)。
- GeckoDriverDownloader用于下载和安装geckodriver(用于Mozilla Firefox)。
- OperaChromiumDriverDownloader用于下载和安装operadriver(用于基于chromium的opera浏览器)。
状态
目前正在MacOS和Windows10上使用Python2.7.16和3.7.2开发/测试。
模块使用示例
示例:
>>> from webdriverdownloader import GeckoDriverDownloader >>> gdd = GeckoDriverDownloader() >>> gdd.download_and_install() 1524kb [00:00, 1631.24kb/s] ('/Users/lsaguisag/webdriver/geckodriver-v0.20.1-macos/geckodriver', '/Users/lsaguisag/bin/geckodriver') >>> gdd.download_and_install("v0.20.0") 1501kb [00:02, 678.92kb/s] Symlink /Users/lsaguisag/bin/geckodriver already exists and will be overwritten. ('/Users/lsaguisag/webdriver/geckodriver-v0.20.0-macos/geckodriver', '/Users/lsaguisag/bin/geckodriver') >>> gdd.download_and_install() Symlink /Users/lsaguisag/bin/geckodriver already exists and will be overwritten. ('/Users/lsaguisag/webdriver/geckodriver-v0.20.1-macos/geckodriver', '/Users/lsaguisag/bin/geckodriver') >>>
命令行工具
还有一个命令行工具也可用。安装软件包后,可以按如下方式使用(Windows示例):
> webdriverdownloader chrome:2.38 firefox opera:v.2.35 Downloading WebDriver for browser: 'chrome' 3300kb [00:00, 11216.38kb/s] Driver binary downloaded to: C:\Users\lsaguisag\webdriver\chrome\2.38\2.38%2Fchromedriver_win32\chromedriver.exe Driver copied to: C:\Users\lsaguisag\bin\chromedriver.exe Downloading WebDriver for browser: 'firefox' 3031kb [00:01, 2253.64kb/s] Driver binary downloaded to: C:\Users\lsaguisag\webdriver\gecko\v0.20.1\geckodriver-v0.20.1-win64\geckodriver.exe Driver copied to: C:\Users\lsaguisag\bin\geckodriver.exe Downloading WebDriver for browser: 'opera' 3548kb [00:02, 1239.02kb/s] Driver binary downloaded to: C:\Users\lsaguisag\webdriver\operachromium\v.2.35\operadriver_win64\operadriver_win64\operadriver.exe Driver copied to: C:\Users\lsaguisag\bin\operadriver.exe WARNING: Path 'C:\Users\lsaguisag\bin' is not in the PATH environment variable.
在上面的示例中,为chrome和opera指定了一个版本,而没有为firefox指定任何版本,因此geckodriver的最新版本被隐式下载。
待办事项
- 在Linux上测试
许可证
这是根据麻省理工学院的许可证发布的。有关详细信息,请参阅此存储库中的LICENSE文件。
下载/使用webdrivers之前,请咨询webdrivers下载提供商的许可条款。