在selenium中,有时候选择好了元素,但是进行click()操作的时候会出问题。
如下图,报错为unable to locate element:
![](https://img.haomeiwen.com/i8449589/5ccc9cd23963cbb9.png)
此时,添加点击事件即可:
element = driver.find_element_by_xpath("表达式")
driver.execute_script("arguments[0].click();", element)
如下图:
![](https://img.haomeiwen.com/i8449589/e7ca3fa8d2554104.png)
参考:
https://www.cnblogs.com/xiaoguo-/p/12143912.html
网友评论