1

尝试使用 selenium 网格启动 firefox 是通过以下异常:

org.openqa.selenium.sessionnotcreatexception

我正在使用的代码如下:

if(useRemoteWebDriver){
        URL seleniumGridURL = new URL(System.getProperty("gridURL"));
        String desiredBrowserVersion = System.getProperty("desiredBrowserVersion");
        String desiredPlatform = System.getProperty("desiredPlatform");

        if (!desiredPlatform.isEmpty())
            if ((null != desiredPlatform)) {
                desiredCapabilities.setPlatform(Platform.valueOf(desiredPlatform.toUpperCase()));
            }

        if (null != desiredBrowserVersion && !desiredBrowserVersion.isEmpty()){
            desiredCapabilities.setVersion(desiredBrowserVersion);
        }
        webDriver = new RemoteWebDriver(seleniumGridURL, desiredCapabilities);
    }else{
        webDriver = selectedDriverType.getWebDriverObject(desiredCapabilities);
    }

我正在尝试使用从命令行运行它

mvn clean install -Dremote=true -DseleniumGridURL=http://localhost:5555/wd/hub -Dbrowser=firefox -Dwebdriver.gecko.driver="E:\GeckoDriver\geckodriver.exe" -DbrowserVersion="50.0.1"

这给了我以下例外

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe, browserName=firefox, version=50.0.1, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'exipc0006', ip: '172.16.12.123', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_111'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
    at com.HomLuvAutomation.WebDriverThread.instantiateWebDriver(WebDriverThread.java:89)
    at com.HomLuvAutomation.WebDriverThread.getDriver(WebDriverThread.java:40)
    at com.HomLuvAutomation.DriverFactory.getDriver(DriverFactory.java:46)
    at com.HomLuvAutomation.BasicSearchWD.exampleOfTestNgMaven(BasicSearchWD.java:22)
    at com.HomLuvAutomation.BasicSearchWD.austinSearch(BasicSearchWD.java:56)
4

0 回答 0