我尝试在 IE11 32bit 上运行 Vaadin TestBench 测试。
我已经找到了这个线程:无法使用 Selenium2 (Webdriver) 和 Java 启动 IE 浏览器,但这对我没有帮助。运行 IE11 的测试用例后,我仍然看到此错误:
org.openqa.selenium.NoSuchWindowException: Unable to get browser
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 19 milliseconds
Build info: version: '2.44.0',
revision:'76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'isa-050', ip: '192.168.100.14', os.name: 'Windows 7',
os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_66'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true,
ie.forceCreateProcessApi=false, pageLoadStrategy=normal,
ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true,
version=11, platform=WINDOWS, nativeEvents=true,
ie.ensureCleanSession=false, elementScrollBehavior=0,
ie.browserCommandLineSwitches=, requireWindowFocus=false,
browserName=internet explorer, initialBrowserUrl=http://localhost:29878/,
takesScreenshot=true, javascriptEnabled=true,
ignoreProtectedModeSettings=true, enableElementCacheCleanup=true,
cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 61623ee3-9a3a-4cc9-96d0-d9d8202647d1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
at com.vaadin.testbench.commands.TestBenchCommandExecutor.waitForVaadin(TestBenchCommandExecutor.java:133)
at com.vaadin.testbench.TestBenchDriverProxy_$$_jvst375_1._d65waitForVaadin(TestBenchDriverProxy_$$_jvst375_1.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.vaadin.testbench.DriverInvocationHandler.invoke(DriverInvocationHandler.java:62)
at com.vaadin.testbench.TestBenchDriverProxy_$$_jvst375_1.waitForVaadin(TestBenchDriverProxy_$$_jvst375_1.java)
at com.vaadin.testbench.DriverInvocationHandler.waitForVaadinIfNecessary(DriverInvocationHandler.java:78)
at com.vaadin.testbench.DriverInvocationHandler.invoke(DriverInvocationHandler.java:48)
at com.vaadin.testbench.TestBenchDriverProxy_$$_jvst375_1.getKeyboard(TestBenchDriverProxy_$$_jvst375_1.java)
at org.openqa.selenium.interactions.Actions.<init>(Actions.java:41)
at test_project.Testfaelle.findeTabellenElement(Testfaelle.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
这是我的测试用例:
@Test
public void findeTabellenElement(){
System.setProperty("webdriver.ie.driver", "C:\\Users\\amustroph\\Desktop\\IEDriverServer.exe");
//DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
//capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
//WebDriver driver1 = new InternetExplorerDriver(capabilities);
//setDriver(driver1);
setDriver(new InternetExplorerDriver());
try {
getDriver().get("http://localhost:8080/MavenVaadinHelloWorld");
Thread.sleep(7000);
Actions action = new Actions(getDriver());
WebElement w1 = findElement(By.className("v-table-caption-container"));
action.moveToElement(w1).click().perform();
Thread.sleep(5000);
action.moveToElement(w1).click().perform();
Thread.sleep(10000);
WebElement table = $(TableElement.class).get(0);
action.moveToElement(table).perform();
Thread.sleep(7000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
getDriver().quit();
}
我还添加了我的 IE 配置的图片。也许我忘记了什么?
你有什么主意吗?