selenium自动化脚本错误总结
来源:互联网 发布:工农牌糖精淘宝网 编辑:程序博客网 时间:2024/06/05 18:01
编写selenium脚本时,会犯些错误,纪录下来,方便自己后续查看
1、定位元素时提示:
unknown error: Element is not clickable at point (580, 47). Other element would receive the click: <label for="stb_1">...</label>
提示:元素无法点击,其他的元素会接收此点击行为。
分析原因,首先肯定不是因为页面元素不存在而无法点击。
分析后得出,实际上这个页面元素是存在的,而是被另外一个弹层挡住了。
2、 selenium.common.exceptions.NoAlertPresentException: Message: no alert open
提示没有alert弹框弹出,分析得出是因为前面有个元素没有定位到,但是为什么不直接提示元素没有定位到,而是提示没有alert弹出。。。
3、 alert = driver.switch_to.alert()
TypeError: 'Alert' object is not callable
对象不能用函数形式调用,就是不能callable。 此类错误一般是由于内部函数被用作变量名时发生
4、
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
没有安装火狐浏览器的驱动,我安装环境时,只安装了chrome的驱动,安装firefox的驱动即可
5、
driver.find_element_by_id("su").click() raise exception_class(message, screen, stacktrace)selenium.common.exceptions.WebDriverException: Message: unknown error: Element is not clickable at point (611, 28) (Session info: chrome=54.0.2840.71) (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.5 x86_64)
因为在程序中使用了set_window_size设置了窗口的大小,窗口缩小后,导致某个元素无法点击;
解决办法:将set_window_size设置的宽度调大,使driver.find_element_by_id(“su”).click()被定位的元素不被遮挡即可。
6、
tagname1 = root.getElementByTagName('browser')AttributeError: 'Element' object has no attribute 'getElementByTagName'
在定位元素过程中,注意当获取一组标签时,element是复数,改为tagname1 = root.getElementsByTagName(‘browser’)即可;
7、
raise ImportError('Start directory is not importable: %r' % start_dir)ImportError: Start directory is not importable: './tesCase/'
这个错误很低级,然后自己还找了好久,记录一下,路径写错了,’./testCase/’,少了一个字母t
- selenium自动化脚本错误总结
- selenium运行自动化脚本(验证通过)
- 自动化测试-selenium IDE脚本录制
- Selenium Webdriver 编写UI自动化测试脚本
- python 自动化测试脚本-->selenium应用
- selenium练习三:百度搜索自动化脚本
- Selenium自动化测试工具使用总结
- EasyUI selenium自动化的一些总结
- 自动化-Selenium WebDriver相关技术点总结
- 自动化selenium
- selenium运行自动化脚本(调试验证通过)
- 使用Python+selenium实现第一个自动化测试脚本
- 基于selenium的自动化测试脚本编写-python
- 自动化测试脚本工具,在eclipse里加pydev插件,selenium
- python+selenium自动化脚本跑完后提示TextIOWrapper信息
- python+selenium 编写第一个自动化脚本 Ie版
- socket脚本错误总结
- socket脚本错误总结
- Android进程保活全攻略(上)
- 扁平化设计的内涵
- XXX事件的重载均与委托"System.EventHandler"不匹配
- 程序员的必读书单
- 用FFT分析信号,建议自认为懂了的看看
- selenium自动化脚本错误总结
- Spark执行原理概述
- 习题42 对象、类及从属关系
- kvm实现cpu独立的案例
- C语言的基础学习及特殊例题的实现
- Android SystemServer 启动流程
- List集合中的对象根据属性排序
- pull方法写XML文件
- 仓促之间写的,有些不足,希望道友们给我建议