How to get the current URL in Selenium

Java

In Java, use the Webdriver’s getCurrentUrl() method.

String url = driver.getCurrentUrl();

Python

In Python, the Webdriver has a current_url property.

url = driver.current_url

C#

In C#, the Webdriver has a Url property.

string url = driver.Url;