【问题标题】:Cannot use Webdriver in Mac OS X ?无法在 Mac OS X 中使用 Webdriver?
【发布时间】:2016-07-26 12:47:44
【问题描述】:

这里是 StackTrace:

我的操作系统版本是 10.11.2 (15C50)

【问题讨论】:

    标签: macos webdriver


    【解决方案1】:

    发生这种情况是因为 selenium 无法检测到您的 Firefox 的位置。你需要设置System.setProperty来协助selenium了解你系统中firefox的位置

    根据https://github.com/SeleniumHQ/selenium/wiki/FirefoxDriver,您必须设置一个属性来设置二进制路径:

    webdriver.firefox.bin
    

    对于我的系统,我在以下位置安装了 Firefox:-

    System.setProperty("webdriver.firefox.bin","/Applications/Firefox20.0"); 
    WebDriver driver = new FirefoxDriver();
    

    一些系统的位置如下:-

    System.setProperty("webdriver.firefox.bin","/Applications/Firefox.app/Contents/MacOS/firefox-bin");
    

    或

    有一些补充的问题,请参阅下面的链接:-

    Failed to connect to binary FirefoxBinary with Selenium in Maven

    希望对你有帮助:)

    【讨论】:

    • 通过替换为正确的版本解决。谢谢~
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-17
    • 2013-11-06
    • 2013-10-31
    • 2017-07-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多