本文摘自php中文网,作者little bottle,侵删。
Selenium是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。本文主要讲述的是web测试中Selenium 3使用的问题集以及解决方案。
1. 无法启动FireFox--geckodriver
运行 driver=webdriver.Firefox()
运行报错:
Exception AttributeError: "'Service' object has no attribute 'process'" in <boun
d method Service.__del__ of <selenium.webdriver.firefox.service.Service object a
t 0x028940B0>> ignored
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executabl needs to be in PATH.
解决方案:
下载https://github.com/mozilla/geckodriver/releases 最新版,把geckodriver.exe加到系统path路径下,即可解决此问题。
2. Firefox默认安装,但找不到启动路径
selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
解决方案:
加入这几行代码就可以解决。
1 2 3 4 5 |
|
3. 无法启动IE 的问题
1 |
|
selenium.common.exceptions.WebDriverException: Message: 'IEDriverServer.exe' executable needs to be in PATH. Please download from http://selenium-release.storage.googleapis.com/index.html and read up at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.ie.service.Service object at 0x0276B6F0>> ignored
解决方案:
这里下载驱动: http://selenium-release.storage.googleapis.com/index.html?path=3.0/,把IEDriverServer.exe放到系统path目录即可。
【推荐课程:Python视频课程】
以上就是web自动化测试(一)Selenium 3使用系列问题集的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Python close()是什么?Python close()定义及用法详解
Python中的并发处理之asyncio包使用的详解_Python
更多相关阅读请进入《Python》频道 >>

Python编程 从入门到实践 第2版
python入门书籍,非常畅销,超高好评,python官方公认好书。