我在等待URL更改时遇到以下错误。
问题是间歇性的,我并不总是得到错误。所以,如果我只是说getCurrentURL
它就过去了。我猜它可以像在expctedConditions中一样多次调用它。
wait.until(ExpectedConditions.urlContains("cart-complete")));
浏览器: Firefox 45.0
Wedriver::2.52.0
栈跟踪
引起:org.openqa.selenium.WebDriverException:远程浏览器做了 不响应getCurrentUrl构建信息:版本:'2.52.0',修订版: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28',时间:'2016-02-11 11:22:43'系统信息:主持人:'ip-172-31-41-152',ip:'172.31.41.152', os.name:'Linux',os.arch:'amd64',os.version: '4.9.38-16.33.amzn1.x86_64',java.version:'1.8.0_45'驱动程序信息: driver.version:RemoteWebDriver org.openqa.selenium.remote.RemoteWebDriver.getCurrentUrl(RemoteWebDriver.java:328) org.openqa.selenium.support.ui.ExpectedConditions $ 4.适用(ExpectedConditions.java:131) org.openqa.selenium.support.ui.ExpectedConditions $ 4.适用(ExpectedConditions.java:126) org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:238) uk.co.pharmica.libs.Page.waitUntilURLContains(Page.java:112) uk.co.pharmica.pages.buyer.CartCompletePage。(CartCompletePage.java:24) sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:422) org.openqa.selenium.support.PageFactory.instantiatePage(PageFactory.java:129) org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:64) uk.co.pharmica.tests.Buyer.test3DSecure(Buyer.java:66) sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:497) org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) org.testng.internal.Invoker.invokeMethod(Invoker.java:639) org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816) org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124) org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108) org.testng.TestRunner.privateRun(TestRunner.java:774) org.testng.TestRunner.run(TestRunner.java:624) org.testng.SuiteRunner.runTest(SuiteRunner.java:359) org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) org.testng.SuiteRunner.run(SuiteRunner.java:261) org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) org.testng.TestNG.runSuitesSequentially(TestNG.java:1191) org.testng.TestNG.runSuitesLocally(TestNG.java:1116) org.testng.TestNG.run(TestNG.java:1024) org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281) org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75) org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121) org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
答案 0 :(得分:0)
使用这种方式我解决了我的问题
wd.navigate().to(URL)
网址正在打开我的网站。
if (browser.equalsIgnoreCase("ie")) {
System.out.println(" Executing on IE");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setBrowserName("ie");
String Node = "http://192.168.2.5:5555/wd/hub";
wd = new RemoteWebDriver(new URL(Node), cap);
wd.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Launch website
wd.navigate().to(URL);
}
答案 1 :(得分:0)
如果没有更多背景信息,我会假设您有2个双引号用于"" cart-complete"。