0

I am trying to use selenium to start google chrome but i get an error here is my code:

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

here is the error:

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

any help with that?

Chanda Korat
  • 2,453
  • 2
  • 19
  • 23
Hossam Salah
  • 185
  • 1
  • 13

1 Answers1

0

Make sure you have latest geckodriver and firefox is installed in default dir.

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH leads to geckodriver issue, can be solved by providing the path to the geckodriver. Possible reason, geckdriver location is not added to the PATH.

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

Exception AttributeError: "'Service' object has no attribute 'process'" looks like to me your firefox is installed in custom location. Please confirm.

Dave
  • 299
  • 1
  • 7