1
votes

I am getting following error while waiting for the URL to change.

The issue is intermittent, I doesn't always get the error. So if I will simply say getCurrentURL it passes. I guess it has do with calling it multiple times as it does in expctedConditions.

wait.until(ExpectedConditions.urlContains("cart-complete")));

Browser: Firefox 45.0

Wedriver:: 2.52.0

stacktrace

Caused by: org.openqa.selenium.WebDriverException: Remote browser did not respond to getCurrentUrl Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43' System info: host: '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 info: driver.version: RemoteWebDriver org.openqa.selenium.remote.RemoteWebDriver.getCurrentUrl(RemoteWebDriver.java:328) org.openqa.selenium.support.ui.ExpectedConditions$4.apply(ExpectedConditions.java:131) org.openqa.selenium.support.ui.ExpectedConditions$4.apply(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(Native Method) 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(Native Method) 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)

2
Can you give a bit more context? If there is surrounding code that works fine or not? What is your actual URL etc. - Alexey R.
It's a little strange web driver fail to get current url. what will happen if you add driver.getCurrentUrl() before wait? and what happen if run on chrome browser? - yong
Why are you using such old versions of FF and the driver? - JeffC
@Jeff I am using browserstack and with newer version there are other issues. this is the most stable version so far. - Gaurang Shah
@yong it doesn't give me this error everytime, it's intermittent. - Gaurang Shah

2 Answers

0
votes

Using this way I solve my problem wd.navigate().to(URL) URL is opening my site.

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);
}
0
votes

Without any more context, I'd assume that you have 2 double quotations for ""cart-complete".