web自动化测试(一)Selenium 3使用系列问题集

little bottle
发布: 2019-04-10 13:05:08
转载
3416 人浏览过

       Selenium是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。本文主要讲述的是web测试中Selenium 3使用的问题集以及解决方案。

1. 无法启动FireFox--geckodriver

运行 driver=webdriver.Firefox()

运行报错:
Exception AttributeError: "'Service' object has no attribute 'process'" in d method Service.__del__ of 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

解决方案:

加入这几行代码就可以解决。

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

# Create a new instance of the Firefox driver
binary = FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
登录后复制

3. 无法启动IE 的问题

driver = webdriver.Ie()
登录后复制

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 > ignored

解决方案:

这里下载驱动: http://selenium-release.storage.googleapis.com/index.html?path=3.0/,把IEDriverServer.exe放到系统path目录即可。

【推荐课程:Python视频课程

以上是web自动化测试(一)Selenium 3使用系列问题集的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:csdn.net
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!