ChromeDriver.getCurrentUrl() results in infinite loop for XML pages.
Meta
OS: Windows, Linux
Selenium Version: 2.52.0
Browser: Chrome
Browser Version: 64.0.3282.140 (32-bit)
Expected Behavior
When calling webDriver.getCurrentUrl() whilst being on an XML page, it should return the address of that XML page.
Actual Behavior
Instead of returning the URL, it infinitely loops and times out.
Steps to reproduce
The code at our company is a lot more than that, but I tried to boil it down to the actual issue (which is the 'getCurrentUrl' call).
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
WebDriver webDriver = new ChromeDriver();
webDriver.navigate().to("https://github.com/SeleniumHQ/selenium/blob/ceaf3da79542024becdda5953059dfbb96fb3a90/.idea/androidDexCompiler.xml");
webDriver.getCurrentUrl();
@NicolasKogler Can you try with below code .
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class CurrentURLTest {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/PathToChromeDriver/chromedriver");
WebDriver webDriver = new ChromeDriver();
webDriver.navigate().to(
"https://github.com/SeleniumHQ/selenium/blob/ceaf3da79542024becdda5953059dfbb96fb3a90/.idea/androidDexCompiler.xml");
webDriver.getCurrentUrl();
System.out.println(webDriver.getCurrentUrl());
webDriver.quit();
}
}
Hey @dharmakrish6,
thank you, but we already specify the chromedriver executable for the webdriver.chrome.driver property in the maven call (we use the Citrus Test Framework) so this is not the issue.
Driver.getCurrentUrl() works for HTML pages, but not for XML ones.
Kind regards, Nicolas Kogler
Driver.getCurrentUrl() works for HTML pages, but not for XML ones
FWIW, the sample link you gave produces HTML, not XML:
$ URL="https://github.com/SeleniumHQ/selenium/blob/ceaf3da79542024becdda5953059dfbb96fb3a90/.idea/androidDexCompiler.xml"
$ curl -s -I $URL | grep "^Content-Type"
Content-Type: text/html; charset=utf-8
@NicolasKogler Can you please post the xml link, so that we can try to find the solution.
Closing the issue as we didn't get more info from the OP
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.