Home>Article>Backend Development> Web automated testing (1) Selenium 3 usage series problem set

Web automated testing (1) Selenium 3 usage series problem set

little bottle
little bottle forward
2019-04-10 11:48:51 3393browse

Selenium is a tool for web application testing. Selenium tests run directly in the browser, just like real users. This article mainly talks about the problem set and solutions used bySelenium 3 in web testing.

1. Unable to start FireFox--geckodriver

Run driver=webdriver.Firefox()

Run error:
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.

Solution:

Download the latest version from https://github.com/mozilla/geckodriver/releases and add geckodriver.exe to the system path to solve this problem.

2. Firefox is installed by default, but the startup path cannot be found

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

Solution:

Add these lines of code to solve the problem.

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. Problem of being unable to start 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

Solution :

Download the driver here: http://selenium-release.storage.googleapis.com/index.html?path=3.0/, put IEDriverServer.exe in the system path directory Can.

[Recommended course:Python video course]

The above is the detailed content of Web automated testing (1) Selenium 3 usage series problem set. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete