【发布时间】:2018-04-24 21:44:08
【问题描述】:
一旦我通过在 Python 中使用 Selenium 获得了href。
有没有办法根据href 找到XPath 并点击XPath?
例如:
href = '/sweatshirts/vct65b9ze/yn2gxohw4'
如何在该页面上找到XPath?
【问题讨论】:
标签: python selenium xpath selenium-webdriver href
一旦我通过在 Python 中使用 Selenium 获得了href。
有没有办法根据href 找到XPath 并点击XPath?
例如:
href = '/sweatshirts/vct65b9ze/yn2gxohw4'
如何在该页面上找到XPath?
【问题讨论】:
标签: python selenium xpath selenium-webdriver href
当元素例如是一个链接时,您可以使用以下代码:
driver.find_element_by_xpath('//a[@href="/sweatshirts/vct65b9ze/yn2gxohw4"]');
【讨论】: