2017-04-06 115 views
0

最近,我将自动化脚本从硒2.53迁移到3.3.1版本,并且由于以下原因,我们无法在Firefox版本中运行脚本例外。读音字使用火狐50.1.0和壁虎v0.15.0无法使用硒在Firefox 50.1.0上运行硒脚本3.3.1

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 
+0

好,和你有什么问题吗? – acikojevic

+0

使用壁虎驱动程序v01.15和noro最新的FireFox浏览器 – kushal

+0

您必须更新您的Firefox浏览器版本> = 52以上 –

回答

0

您需要提供的Firefox二进制位置。这样做的一个方法是通过下面的代码 -

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"); 

这里更多信息 - http://www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/

+0

它不起作用。 –

+0

你能分享你使用的代码吗?你也使用所有最新版本? –