Get Current URL using Selenium WebDriver (Java)

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.


See Working Example



Using Python

Leave a reply

Your email address will not be published. Required fields are marked*

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.