2016-01-21 82 views
0

我剛剛成立我的日食/ Python的插件/硒插件和拳頭測試腳本做了嘗試:Python的硒編譯錯誤

from selenium import webdriver 
from selenium.webdriver.common.keys import Keys 

driver = webdriver.Chrome() 
driver.get("http://www.python.org") 
assert "Python" in driver.title 
elem = driver.find_element_by_name("q") 
elem.send_keys("pycon") 
elem.send_keys(Keys.RETURN) 
assert "No results found." not in driver.page_source 
driver.close() 

但是我得到以下錯誤:

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x0169C690>> 
Traceback (most recent call last): 
    File "C:\Python\lib\site-packages\selenium\webdriver\common\service.py", line 141, in __del__ 
    File "C:\Python\lib\site-packages\selenium\webdriver\common\service.py", line 120, in stop 
    File "C:\Python\lib\site-packages\selenium\webdriver\common\service.py", line 95, in send_remote_shutdown_command 
    File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
    File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked 
    File "<frozen importlib._bootstrap>", line 887, in _find_spec 
TypeError: 'NoneType' object is not iterable 

在Mozilla上,腳本運行時沒有錯誤。 在Chrome上,腳本運行時出現上面的錯誤,但完成。 在IE上,腳本從上面的錯誤運行,但沒有完成。

你知道爲什麼這種行爲會發生在我身上嗎?

謝謝, 麥克

回答

2

這是關於Python 3 +硒2.49 +鉻再現的open problem

作爲一種變通方法,降級到硒2.48

pip3 install selenium==2.48