Selenium是用於Web應用程式測試的工具。 Selenium測試直接運行在瀏覽器中,就像真正的使用者在操作一樣。本文主要講述的是web測試中Selenium 3所使用的問題集以及解決方案。
1. 無法啟動FireFox--geckodriver
執行driver=webdriver.Firefox()
# 執行錯誤:
Exception AttributeError: "'Service' object has no attribute 'process'" in
t 0x028940B0> ignored
解決方案:#解決方案:
下載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
以上是web自動化測試(一)Selenium 3使用系列問題集的詳細內容。更多資訊請關注PHP中文網其他相關文章!