在IE

时间:2017-10-17 05:41:43

标签: selenium internet-explorer selenium-webdriver selenium-grid selenium-iedriver

Selenium 3.4.0

IE 11

Windows 10

我正在使用Webdriver(RemoteWebDriver)启动IE。但它被http://localhost//some_random_number所困扰,并且没有进一步移动。启动IE的代码是:

    WebDriver driver = null; String errMsg = "";

    try { 
        DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
        cap.setBrowserName("internet explorer");
        URL sURL = null;
        sURL = new URL("http://localhost:5558/wd/hub");
        driver = new RemoteWebDriver(sURL, cap);
    } catch (Exception e) {
        throw e;
    }

启动HUB和IE网格的命令是:

   cd "<path to seleniumjar>" && D: && javaw -jar selenium-server-standalone-3.4.0.jar -port 4444 -role hub

   cd "<path to seleniumjar and ie driver" && D: && javaw -Dwebdriver.ie.driver=IEDriverServer_64.exe -jar selenium-server-standalone-3.4.0.jar -role webdriver -hub http://localhost:4444/grid/register -browser browserName="internet explorer",platform=WINDOWS,maxInstances=5 -port 5558

此外,整个硒线在这里挂了3个小时,然后发生异常

Error: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'INNOSZPC00536', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:137)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
    at com.automatics.packages.library.Web$Helper.launchIE(Web.java:2645)
    at com.automatics.packages.library.Web$Helper.access$0(Web.java:2568)
    at com.automatics.packages.library.Web.wbLaunchBrowser(Web.java:92)
    at com.automatics.packages.testScripts.google_tc.test(google_tc.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
    at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at org.apache.http.impl.conn.LoggingInputStream.read(LoggingInputStream.java:87)
    at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
    at ...

如果浏览器无法访问,我想在30秒后退出,如何将此默认3小时超时重置为30秒。如果执行被困在localhost页面,该怎么做。

0 个答案:

没有答案