Ich versuche, ein einfaches Python-Skript für die Verbindung mit einem Web-Browser mit dem Selen-Paket. Das Fehlerprotokoll wie gezeigt wird unten angezeigt.Fehler bei der Verwendung von Python-Selen-Paket
Traceback (most recent call last):
File "F:\WinPython\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "F:\WinPython\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "F:\WinPython\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Während der oben genannten Ausnahmebehandlung, eine weitere Ausnahme aufgetreten:
Traceback (most recent call last):
File "F:/WinPython/WinPython-64bit-3.5.2.3Qt5/python-3.5.2.amd64/py_codes/python_org_search.py", line 4, in <module>
driver = webdriver.Firefox()
File "F:\WinPython\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__
self.service.start()
File "F:\WinPython\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\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.
Ausnahmelog ist nicht genug, um das Problem zu verstehen. Zeigen Sie Ihren Code auch – Andersson
Duplikat von http://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path, die bereits die Antwort hat – CJC
@Andersson hier ist der Code aus Selen import WebDriver von selenium.webdriver.common.keys importieren Keys driver = webdriver.Firefox() driver.get ("http://www.python.org") assert "Python" in driver.title Elem = driver.find_element_by_name ("q") elem.clear() elem.send_keys ("PyCon") elem.send_keys (Keys.RETURN) assert "Keine Ergebnisse gefunden." nicht in driver.page_source driver.close() – Anjishnu