Get Current URL using Selenium WebDriver (Java)
To get the current page's URL, use the WebDriver method getCurrentUrl() like so:
String url = driver.getCurrentUrl(); System.out.println(url);
This example will store the URL into a String variable and print it to the console.
Leave a reply
Your email address will not be published. Required fields are marked*