2017-02-10 21 views
0

我将我的Selenium应用程序从2.53迁移到3.0.1。首先,我想在一个小应用程序中测试它,只需启动浏览器并导航到特定页面即可。
此外,我想使用Firefox的自定义二进制文件(版本51.0,便携式应用程序)。Selenium 3.0.1与新的FirefoxDriver + Marionette卡在开始页面

这是我代码

public class Selenium { 

     public static void main(String[] args) { 
      WebDriver driver = createFFDriver(); 
      driver.navigate().to("http:...."); 
      System.out.println("Finished"); 
     } 

     public static WebDriver createFFDriver(){ 
      System.setProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY,"foo/geckodriver64.exe"); 
      DesiredCapabilities capabilities = DesiredCapabilities.firefox(); 
      capabilities.setCapability("firefox_binary","foo/firefox.exe"); 
      return new FirefoxDriver(capabilities); 
     } 
} 

浏览器实际上是打开了,但受阻。
日志

1486713046153 geckodriver INFO Listening on 127.0.0.1:12466 
Feb 10, 2017 8:50:46 AM org.openqa.selenium.remote.ProtocolHandshake 
createSession INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end 
1486713046731 mozprofile::profile INFO Using profile path foo\AppData\Local\Temp\rust_mozprofile.p25D0Gb1sBQm 
1486713046752 geckodriver::marionette INFO Starting browser foo\firefox\51.0\FirefoxPortable.exe 
1486713046782 geckodriver::marionette INFO Connecting to Marionette on localhost:52818 

为什么Geckodriver监听127.0.0.1:12466但它试图连接到木偶的localhost:52818

这是网页,我卡住: enter image description here

编辑: 它卡在RemoteWebDriver startSession方法:

Response response = this.execute("newSession", parameters); 

回答

0

看来,火狐携带版不与壁虎驱动程序运作良好。
它与传统Firefox(51.0.1)一样符合预期。

0

我试图与硒v您的代码3.0.1 Firefox 51.0.1(32位),并成功访问URL /其他网络驱动程序功能/无阻塞。

UPDATE

WebDriver firefox; System.setProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY,"pathtogeckodriver"); FirefoxProfile profile = new FirefoxProfile(); firefox = new FirefoxDriver( new FirefoxBinary( new File(System.getProperty("user.dir"), "\\FirefoxPortable\\FirefoxPortable.exe")), profile); driver.get("http://www.google.com");

这与便携Firefox版本(51.0.1)完美的作品

+0

它不起作用。你使用的是便携式应用程序版本的Firefox? – buzz2buzz

+0

我试过了,但它也不能正常工作......当浏览器启动时,仍然停留在用户配置文件页面。你有没有关于什么配置点可以区分我们的想法? – buzz2buzz

+0

你会得到什么例外? /你卡在哪里? –

相关问题