Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.2k views
by The go-to Tester (218 points)
edited by

I am automatating test using Selenium Webdriver in Python language. How ever I am getting error. My program is-:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] =True
firefox_capabilities['binary'] = 'C:\Selenium driver\geckodriver.exe'
driver = webdriver.Firefox(capabilities = firefox_capabilities)
assert "Selenium" in driver.title
driver.close()
 
I am getting the following error-:
Traceback (most recent call last):
  File "E:\PythonExample.py", line 7, in <module>
    driver = webdriver.Firefox(capabilities = firefox_capabilities)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 60, in __init__
    self.service.start()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\service.py", line 68, in start
    available in the path.\n %s" % str(e))
WebDriverException: Message: 'wires' executable needs to be                 available in the path.
 [Error 2] The system cannot find the file specified
 
Please help
 

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

Here firefox_capabilities['binary']  is location to the firefox binary and not gekodriver.exe file.

You can set the location of gekodriver.exe file in PATH variable to use it.

Eg. in Mac machine you can set path as given below

export PATH=$PATH:/Users/myproject/geckodriver-0.8.0-OSX

Hope that helps!

by The go-to Tester (218 points)
I have changed binary path to
firefox_capabilities['binary'] = 'C:\Program Files (x86)\Mozilla Firefox'

I am still getting the same error
by The go-to Tester (181 points)
include firefox.exe as well and let us know.

firefox_capabilities['binary'] = 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
by The go-to Tester (218 points)
Works now!!!
...