python+selenium 学习之路笔记:鼠标悬停事件报错selenium.common.exceptions.NoSuchElementException

学习自动化测试的道路上,遇到各种各样的问题,在学习的过程中,记录遇到的问题以及解决方法

本次学习是以百度为例,参考《selenium2自动化测试实战基于python语言》书籍进行学习的 ,由于第一次记录学习笔记,写的不好的地方请大家见谅

鼠标悬停事件的时候报错,通过find_element_by_link_text("xx") 来获取定位,然后运行的时候,会报错

python+selenium 学习之路笔记:鼠标悬停事件报错selenium.common.exceptions.NoSuchElementException

python+selenium 学习之路笔记:鼠标悬停事件报错selenium.common.exceptions.NoSuchElementException

通过报错去百度,百度上大佬们解释到该报错的原因“浏览器中能定位到元素,但是代码中提示找不到元素”;然后返回自己的代码把link定位的方式改为XPath定位,然后再次运行后就正常了

python+selenium 学习之路笔记:鼠标悬停事件报错selenium.common.exceptions.NoSuchElementException