在Selenium中进行了一系列导航之后,我正在尝试获取当前的url。我知道有一个名为getLocation的ruby命令,但我找不到Python的语法。
发布于 2013-04-13 16:53:39
对Python2使用current_url元素:
print browser.current_url
对于Python 3和更高版本的selenium:
print(driver.current_url)
发布于 2015-03-12 16:08:09
根据这个documentation (一个充满美食的地方:):
driver.current_url
或者,请参阅官方文档:https://www.selenium.dev/documentation/en/webdriver/browser_manipulation/#get-current-url
发布于 2013-08-02 15:53:07
Selenium2Library有get_location():
import Selenium2Library
s = Selenium2Library.Selenium2Library()
url = s.get_location()
https://stackoverflow.com/questions/15985339
复制相似问题