Selenium 2.53.0 firefox bugging

2020-04-21 05:53发布

So, when I try to open firefox like it either pops up really quickly, or it just stays there for a second until I can see it then crashes Also, I use selenium version 2.53.1

    WebDriver driver = new FirefoxDriver();
    driver.get("http://stackoverflow.com");

1条回答
小情绪 Triste *
2楼-- · 2020-04-21 06:05

Just like the other drivers available to Selenium from other browser vendors, Mozilla has released an executable geckodriver that will run alongside the browser.

You need to download latest executable geckodriver from here and set this downloaded path from your machine as system property to run your test case with Firefox driver as below :

 System.setProperty("webdriver.gecko.driver","path/to downloaded/geckodriver.exe");
 DesiredCapabilities capabilities = DesiredCapabilities.firefox();
 capabilities.setCapability("marionette", true);
 WebDriver driver = new FirefoxDriver(capabilities);
  driver.get("http://stackoverflow.com");
查看更多
登录 后发表回答