2017-03-02 5 views
0

私はGoogleのクロムを開始するために、セレンを使用しようとしていますが、私はここでエラー を取得するには、私のコードです:ここセレンwebdriver.firefox()エラー

from selenium import webdriver 
browser = webdriver.Firefox() 
browser.get('http://localhost:8000') 
assert 'Django' in browser.title 

は誤りです:

Traceback (most recent call last): 
File "functional_tests.py", line 5, in <module> 
browser = webdriver.Firefox(firefox_binary=binary) 
File "C:\Python27\lib\site- 
packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__ 
self.service.start() 
File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start 
os.path.basename(self.path), self.start_error_message) 
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x03D51FD0>> ignored 

それを助けてくれる?

+0

私は尋ねる前にそれを読む。それは同じエラーではない –

答えて

0

最新のgeckodriverを持っていて、デフォルトのディレクトリにfirefoxがインストールされていることを確認してください。

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATHは、geckodriverの問題につながり、geckodriverへのパスを提供することで解決できます。考えられる理由は、頸部の位置はPATHに追加されません。

binary = FirefoxBinary('path') 
browser = webdriver.Firefox(firefox_binary=binary) 

Exception AttributeError: "'Service' object has no attribute 'process'"あなたのfirefoxはカスタムロケーションにインストールされています。ご確認ください。

関連する問題