2012-09-24 3 views
5

Selenium의 Firefox 드라이버를 사용하고 싶습니다. 하지만 아래 오류가 있습니다. Firefox가 제대로 설치되지 않았을 수 있습니까?파이썬에서 셀레늄 모듈. firefox 드라이버 사용 방법

------ 내 소스 ------

from selenium import webdriver 

driver = webdriver.Firefox() 

------ 내 소스 끝 ------ 여기

이었다 오류입니다 반환 :

Traceback (most recent call last): 
    File "test.py", line 4, in <module> 
    browser = webdriver.Firefox() 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 51, in __init__ 
    self.binary, timeout), 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__ 
    self.binary.launch_browser(self.profile) 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 43, in launch_browser 
    self._start_from_profile_path(self.profile.path) 
    File "/usr/local/lib/python2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 65, in _start_from_profile_path 
    env=self._firefox_env).communicate() 
    File "/usr/local/lib/python2.7/subprocess.py", line 679, in __init__ 
    errread, errwrite) 
    File "/usr/local/lib/python2.7/subprocess.py", line 1228, in _execute_child 
    raise child_exception 
AttributeError: 'NoneType' object has no attribute 'rfind' 
+1

Firefox를 웹 서버 외부에서 정상적으로 실행할 수 있습니까? 크롬이나 IE 드라이버에서 발생합니까? – Arran

답변

4

나는 동일한 오류가 발생했으나 Firefox를 설치할 때 수정되었습니다. 파이어 폭스가 설치되지 않았다는 것을 깨닫지 못했다. 확인 해봐.

0

셀레늄 webdriver를 사용하면 프로그래밍 방식으로 웹 컨텐츠에 액세스 할 수 있습니다. 그것은 실제 브라우저를 구동하므로, 예, webdriver.Firefox()을 인스턴스화하려면 Firefox가 설치되어 있어야합니다.

관련 문제