I am running selenium on python and I have firefox installed.
When I try to open firefox with selenium I am getting a nasty error. My code is running fine on my main machine (win10) but when I run it on a virtual machine (win7) I get this error:
"C:\Program Files (x86)\Python35-32\python.exe" C:/Users/win7.PC/Desktop/Kijiji/kijiji.py
Traceback (most recent call last):
File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Program Files (x86)\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Program Files (x86)\Python35-32\lib\subprocess.py", line 1224, 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 "C:/Users/win7.PC/Desktop/Kijiji/kijiji.py", line 408, in <module>
driver = webdriver.Firefox()
File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
self.service.start()
File "C:\Program Files (x86)\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 0x02963690>>
Traceback (most recent call last):
File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Program Files (x86)\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'
Process finished with exit code 1
I've upgraded python, selenium and I tried with firefox 47, 46 and even 28 :(
I attempted to change the PATH:
from selenium import webdriver
driver = webdriver.Firefox(path="C:\Program Files (x86)\Mozilla Firefox\Firefox.exe")
It indicated that 'path' is not a valid input
attempted to change binary path like so:
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
Still same issue.
Does anyone have any suggestions?