파이썬 웹 스크래핑을 배우려고하지만 셀렌이 어느 브라우저에서든 작동하지 않습니다.셀레늄이 Firefox 또는 Chrome에서 작동하지 않습니다.
from selenium import webdriver
browser = webdriver.Firefox()
이것은 내가 가지고있는 모든 코드이며 오류가 발생합니다.
Traceback (most recent call last):
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1220, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "H:\codingpractice\python\python challenge.com.py", line 2, in <module>
browser = webdriver.Firefox()
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
self.service.start()
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00A11350>>
Traceback (most recent call last):
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Users\tjhall\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
내 환경 변수에서 그것의 경로를 추가하는 코드
from selenium import webdriver
browser = webdriver.Firefox("C:\Program Files (x86)\Mozilla Firefox\firefox.exe")
의 경로를 추가하는 내가 인터넷에서 찾을 수있는 모든 것을 시도했다. 나는 이것을 알아낼 수 없습니다 ...
이 http://stackoverflow.com/의 중복 것 같은데 :
이 코드를 시도하십시오 : 아래 코드 enter link description here에서 다운로드 파이썬 스크립트가있는 디렉토리에 exe를 넣어 시도해야 질문/40208051/selenium-using-python-geckodriver-executable-need-to-be-in-path –