org.openqa.selenium.SessionNotCreatedException:无法创建新服务:InternetExplorerDriverService

时间:2018-10-29 06:01:28

标签: selenium-grid

公共WebDriver launchTargetUrl(String moduleName)引发IOException,InterruptedException {     DesiredCapabilities cap = null;     System.out.println(moduleName);     尝试{

    // *************** Selenium Grid Setup***************// 
     String nodeUrl; if(moduleName.equals("Transactions")) 
     { 
     nodeUrl = "http://10.xx.xxx.xx:5555/wd/hub"; 
     } 
     else { 
    nodeUrl ="http://10.xx.xxx.xx:5557/wd/hub"; 
    } 
     cap = DesiredCapabilities.internetExplorer();
     cap.setCapability(CapabilityType.PLATFORM,Platform.WINDOWS );

    // *************** Selenium Grid Setup Ends***************//
    //System.setProperty("webdriver.ie.driver", "./IEDriverServer.exe");
    //System.setProperty("webdriver.chrome.driver", "./chromedriver.exe");
    // Enable the below line if you are not running as Selenium Grid
    //driver = new InternetExplorerDriver();
    //driver = new ChromeDriver();
    driver = new RemoteWebDriver(new URL(nodeUrl), cap);
    driver.get(targeturl);
    driver.manage().window().maximize();
    Thread.sleep(15000);
    return driver;
} catch (Exception e) {
    System.out.println(e);
    return null;
}

}

运行以下命令来注册该节点,并且该节点已成功注册。

C:> java -Dwebdriver.ie.driver =“ C:\ IEDriver.exe” -jar硒服务器独立 -3.7.1.jar -role节点-hub http://10.xx.xxx.xxx:443/grid/register-端口5555 -b 行程序“ browserName = internetexplorer”

当我运行IE套件时出现以下错误

org.openqa.selenium.SessionNotCreatedException: Unable to create new service: InternetExplorerDriverService

相同的代码适用于chrome

0 个答案:

没有答案