简体   繁体   English

无法在带有硒3.3.1的Firefox 50.1.0上运行硒脚本

[英]Could not able to run selenium scripts on Firefox 50.1.0 with selenium 3.3.1

Recently I have migrated my automation scripts from selenium 2.53 to 3.3.1 version, and we could not able to run scripts in Firefox version due to below exception. 最近,我已经将自动化脚本从selenium 2.53迁移到了3.3.1版本,由于以下异常,我们无法在Firefox版本中运行脚本。 im using Firefox 50.1.0 and gecko v0.15.0 即时通讯使用Firefox 50.1.0和gecko v0.15.0

Exception in: TS_Testorg.openqa.selenium.SessionNotCreatedException: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

You would need to provide firefox binary location. 您将需要提供firefox二进制位置。 One way of doing it is by the below code - 一种方法是通过以下代码-

    FirefoxOptions ffOptions = new FirefoxOptions();
    options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //Location where Firefox is installed

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability("moz:firefoxOptions", options);

    FirefoxDriver driver = new FirefoxDriver(capabilities);
    driver.get("http://www.google.com");

More info here - http://www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/ 此处的更多信息-http: //www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM