How do I get current URL in Selenium Webdriver 2 Python? How do I get current URL in Selenium Webdriver 2 Python? python python

How do I get current URL in Selenium Webdriver 2 Python?


Use current_url element for Python 2:

print browser.current_url

For Python 3 and later versions of selenium:

print(driver.current_url)


Selenium2Library has get_location():

import Selenium2Librarys = Selenium2Library.Selenium2Library()url = s.get_location()