TAGS :Viewed: 9 - Published at: a few seconds ago

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

I'm trying to get the current url after a series of navigations in Selenium. I know there's a command called getLocation for ruby, but I can't find the syntax for Python.

Answer 1


Use current_url element. Example:

print browser.current_url

Answer 2


According to documentation (a place full of goodies:)):

driver.current_url

Answer 3


Selenium2Library has get_location():

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