使用,并且Java
对Selenium
火狐驱动包。有几个python
具体的包,但是否可能以一种基于项目容易找到的方式firefoxdriver
将其安装到系统中?geckodriver
Java
Selenium
我一直在使用属性文件:
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>selenium config and vehicle type</comment>
<entry key="gecko">/home/thufir/.gecko/geckodriver</entry>
<entry key="url">http://books.toscrape.com/</entry>
<entry key="driver">webdriver.gecko.driver</entry>
<entry key="usr">admin</entry>
<entry key="pwd">12345</entry>
<entry key="option01">--headless</entry>
</properties>
如果它指向系统上的某个标准位置,那么它的脆弱性就会稍微小一些。(我想也可能将它捆绑在 中JAR
。)
thufir@dur:~$
thufir@dur:~$ sudo apt install firefoxdriver
Reading package lists... Done
Building dependency tree
Reading state information... Done
firefoxdriver is already the newest version (3.8.0-1).
0 upgraded, 0 newly installed, 0 to remove and 98 not upgraded.
thufir@dur:~$
答案1
Debian GNU/Linux 和 Ubuntu 中的 firefoxdriver 包仅适用于早已过时的 Firefox 版本。据我所知,Ubuntu 没有适用于当前 Firefox 版本的 geckdriver 包,因此您必须单独下载它们。只要您自行启动它或它在路径中,Selenium 就会自动使用它。
官方发布版本显然可以在 github 上找到:https://github.com/mozilla/geckodriver/releases
答案2
不完全确定geckodriver
文件在哪里,但它可能在某个地方:
thufir@dur:~$
thufir@dur:~$ cat /usr/share/doc/firefoxdriver/README.Debian
selenium-firefoxdriver for Debian
------------------------
This package contains the prebuilded shared objects for x386 and amd64 to
use firefox webdriver with e.g. python-selenium. Some of the shared objects
are packed inside the webdriver.xpi. The python bindings, which this package
is for, requires the path of all .so and select/copy them files by themself.
The source for selenium-firefoxdriver is the same like the python-bindings but we filter out all other stuff except the webdriver.xpi.
-- Sascha Girrulat <[email protected]> Sat, 22 Aug 2015 11:43:04 +0200
thufir@dur:~$
thufir@dur:~$ dpkg -L firefoxdriver
/.
/usr
/usr/lib
/usr/lib/firefoxdriver
/usr/lib/firefoxdriver/amd64
/usr/lib/firefoxdriver/amd64/x_ignore_nofocus.so
/usr/lib/firefoxdriver/webdriver.xpi
/usr/lib/firefoxdriver/x86
/usr/lib/firefoxdriver/x86/x_ignore_nofocus.so
/usr/share
/usr/share/doc
/usr/share/doc/firefoxdriver
/usr/share/doc/firefoxdriver/README.Debian
/usr/share/doc/firefoxdriver/README.rst.gz
/usr/share/doc/firefoxdriver/changelog.Debian.gz
/usr/share/doc/firefoxdriver/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/firefoxdriver
thufir@dur:~$
更好的答案值得赞赏。有一个xpi
文件,看起来像是 Firefox 的安装程序(?),可能包含geckodriver
压缩文件。