1. 火狐浏览器:expected [object undefined] undefined to be a string (如下:)

解决方案:火狐浏览器版本高(自动升级)的原因。 换成低于53.0版本火狐可以解决问题。
2.报selenium.common.exceptions.NoSuchElementException: Message: 'Could not locate element with index 1'
解决方法:
(1)使用webdriverwait函数设置页面加载延时
(2)也许是因为标签不容易捕捉,可以更换别的方式捕捉,将name,class,id,link_text 分别都尝试一遍
3.selenium.common.exceptions.ElementNotVisibleException。。。。。。
解决方法:
(1)使用webdriverwait函数设置页面加载延时
(2)也许是因为标签不容易捕捉,可以更换别的方式捕捉,将name,class,id,link_text 分别都尝试一遍 。(注意:特别是class很容易导致这类错误)
(3)如果不行,可以尝试使用xpath
(4)就是元素的样式或父级及以上元素含有不可显示属性,以致在有些浏览器中(FirefoxDriver)不能操作,但在正常的浏览器中它是可见和可用的。那么需要检查元素是否具备如下特性:
visibility!= hidden
display != none (is also checked against every parent element)
opacity != 0 (in rc2 this is no longer checked for clicking an element)
height and width are both > 0
for an input, the attribute type != hidden
如果有不符上面的特性之一,那么就用js脚本来处理,
浙公网安备 33010602011771号