Home>Article>Backend Development> Web automated testing (1) Selenium 3 usage series problem set
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
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
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!