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

后端 未结 4 1753
旧时难觅i
旧时难觅i 2020-11-29 21:43

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.

4条回答
  •  猫巷女王i
    2020-11-29 22:30

    Use current_url element for Python 2:

    print browser.current_url
    

    For Python 3 and later versions of selenium:

    print(driver.current_url)
    

提交回复
热议问题