在PATH中找不到Firefox二进制文件。确保安装了Firefox。操作系统似乎是:WIN10

时间:2018-08-17 05:48:58

标签: selenium selenium-webdriver windows-10 environment-variables

我遇到以下错误。你能建议吗?

`Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN10
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:14.902Z'
System info: host: 'CTSAUS-LT-641', ip: '10.243.111.75', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_172'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:116)
    at java.util.Optional.orElseGet(Unknown Source)
    at org.openqa.selenium.firefox.FirefoxOptions.getBinary(FirefoxOptions.java:217)
    at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:161)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:103)
    at newpackage.MyClass.main(MyClass.java:11)`

1 个答案:

答案 0 :(得分:1)

执行错误消息会告诉您:确保已安装Firefox。

然后签出,如果配置正确,即firefox.exe在PATH环境变量中出现的目录中。您可以在命令行中输入echo %PATH%来进行检查。

例如,右键单击Firefox桌面图标,然后检查“属性”对话框以查看Fiurefox的安装位置。

例如,如果firefox.exe在目录"C:\Program Files (x86)\Mozilla Firefox"中,则该目录必须出现在PATH变量的(用分号分隔)列表中。