How to get current URL in Selenium Python?

How to get current URL in Selenium Python?

Hi Richard,

When running a web application in a Selenium script, you may need to get the current URL. Several methods exist, including using the driver.getPageSource() method, but the easiest is to use the driver.getCurrentUrl() method. This method returns the complete URL including protocol, hostname and path, which makes it easy to get all of the information you need for your tests.

To get the current URL in Python you can refer the given blog:

1 Like