我有一些部分的值href(例如,href的查询值)不是一个完整的值。在这种情况下,选择元素的最佳方法是什么(单击、发送键等)?在
我试过很多方法,但效果不太好。特别是,在得到html源代码之后,我使用're'模块,提取了完整的href。然后,我用了webdriver.find_元素(按.XPATH,“//a[@href='the full href']”),但结果是“NoSuchElementError”。 (我假设服务器不断更改href的某些部分)
总之,查找和选择仅包含href值某些部分的元素的最佳方法是什么? (python3.6/硒模块/PhantomJS)
包含值的Href
以值开头的Href
^{pr2}$另一个选项-不按href本身搜索,而是
By.linkedText()
-可能在java中使用selenium,我不知道在python中是否可能包含值的Href
试试这个:
如果
the_full_href
是一个变量,这将起作用相关问题 更多 >
编程相关推荐