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

little bottle
Release: 2019-04-10 13:05:08
forward
3451 people have browsed it

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 by Selenium 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)
Copy after login

3. Problem of being unable to start IE

driver = webdriver.Ie()
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!