美文网首页
selenium 元素click失效

selenium 元素click失效

作者: DavidOcean | 来源:发表于2021-03-01 14:14 被阅读0次

    在selenium中,有时候选择好了元素,但是进行click()操作的时候会出问题。

    如下图,报错为unable to locate element:

    此时,添加点击事件即可:

    element = driver.find_element_by_xpath("表达式")

    driver.execute_script("arguments[0].click();", element)

    如下图:

    参考:

    https://www.cnblogs.com/xiaoguo-/p/12143912.html

    相关文章

      网友评论

          本文标题:selenium 元素click失效

          本文链接:https://www.haomeiwen.com/subject/vrrifltx.html