2016-08-28 20 views
1

互換性をテストするために、webdriver 3 beta 2に更新したいと考えています。
セレンwebdriverを:3.0.0-beta2の
のFirefox:48.0
OS:Windows 7の
コード:webdriver 3 beta2ウィンドウを閉じることができません

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(); 
    } 
} 


しかし、ブラウザが閉じをしません。
私はbrowser.quit()を使用しますが、エラーがスローされた場合には閉じ:

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

答えて

0

は新しいDesiredCapabilitiesインスタンスを作成してみてください。代わりに、すでに私たちはキャップや能力としてそれに名前を付けるならば、それは違いはありませんthere..andさ

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

DesiredCapabilities capabilities = DesiredCapabilities.firefox(); 

関連する問題