1
votes

I wish to update to selenium webdriver 3 beta 2 to test compatibility.
Selenium WebDriver: 3.0.0-beta2
Firefox: 48.0
OS: Windows 7
Code:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class GeckDriverTest {

    public static void main(String[] args) {
        System.setProperty("webdriver.gecko.driver", "src/test/resources/wires.exe");
//      System.setProperty("webdriver.firefox.marionette", "src/test/resources/geckodriver.exe");
//      System.setProperty("webdriver.gecko.driver", "src/test/resources/geckodriver.exe");
        DesiredCapabilities cap = DesiredCapabilities.firefox();
        cap.setCapability("marionette", true);
        cap.setCapability("firefox_binary", "firefoxbinarypath");
        WebDriver browser=new FirefoxDriver(cap);
        browser.get("http://www.seleniumhq.org/");
        browser.findElement(By.linkText("Download")).click();
        browser.close();
    }
}


But browser does not closes.
It closes if I use browser.quit() But throws error:

1472391805470 Marionette INFO Listening on port 56555 1472391808818 Marionette INFO startBrowser 95d29b68-b0bb-487a-915c-4896cfaa09ee 1472391808831 Marionette INFO sendAsync 95d29b68-b0bb-487a-915c-4896cfaa09ee 1472391809520 Marionette INFO sendAsync 95d29b68-b0bb-487a-915c-4896cfaa09ee 1472391809653 Marionette INFO sendAsync 95d29b68-b0bb-487a-915c-4896cfaa09ee 1472391827467 Marionette INFO sendAsync 95d29b68-b0bb-487a-915c-4896cfaa09ee 1472391827483 Marionette INFO sendAsync 95d29b68-b0bb-487a-915c-4896cfaa09ee [Child 6088] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w64-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2046 Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died. Build info: version: 'unknown', revision: '31c43c8', time: '2016-08-02 21:57:56 -0700' System info: host: 'mrunal-laptop', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45' Driver info: driver.version: RemoteWebDriver Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, appBuildId=20160726073904, version=, platform=XP, proxy={}, command_id=1, specificationLevel=0, firefox_binary="firefoxbinarypath", acceptSslCerts=false, browserVersion=48.0, platformVersion=6.1, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Windows_NT, device=desktop}] Session ID: 95d29b68-b0bb-487a-915c-4896cfaa09ee at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:706) at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:531) at practise.GeckDriverTest.main(GeckDriverTest.java:20) Caused by: java.lang.IllegalStateException: UnixUtils may not be used on Windows at org.openqa.selenium.os.ProcessUtils.getProcessId(ProcessUtils.java:188) at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.getPID(UnixProcess.java:222) at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$300(UnixProcess.java:201) at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:132) at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155) at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:196) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:94) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:649) ... 3 more

Firefox Browser throwing error on using quit

1

1 Answers

0
votes

Try creating a new DesiredCapabilities instance.

 DesiredCapabilities capabilities = DesiredCapabilities.firefox();

instead of

 cap.setCapability("marionette", true);
 cap.setCapability("firefox_binary", "firefoxbinarypath");