-2

I do not know how to use the Terminal. I am using Mac. I do not know why some of the commands ask me to use sudo, some of them don't. Neither of them works.

I know I have to download the gecko driver. I have done it. But what now? How do I put the gecko driver in the PATH folder?

I have the gecko driver in my Downloads folder. And that's it. What are the next steps?

Ethan Field
  • 4,646
  • 3
  • 22
  • 43
santosmarco_
  • 121
  • 2

3 Answers3

1

let me give you the solution first.

I understand you have already downloaded Geckodriver, and it is in your Download folder. Follow the following steps

  • go to your root folder (the folder where you intend to write your python code) and create a directory "geckodriver", now copy the content of gekodriver(from Download) into the newly created folder.
  • in your python code you need to import the Webdriver and point to the geckodriver.

    from selenium import webdriver

    browser = webdriver.FireFox(executable_path='geckodriver/geckodriver')

ashah
  • 31
  • 3
  • The following happens: `Message: Unable to find a matching set of capabilities`. I tried the following code: `from selenium import webdriver` `web = webdriver.Firefox(executable_path='/Users/marcosantos/Downloads/geckodriver')` – santosmarco_ Oct 13 '17 at 20:44
0

After the 3.0 selenium version, all the browsers you use over selenium need to know where the executable file to open the browser is.

On general terms you need this steps to start working with selenium:

  1. Browser version installed (firefox, chrome, safari[the preview version works better to me])
  2. Selenium version installed
  3. With the two first point you should download the correct compatibility version. For example, Selenium 3.5 with Firefox 55.0.3 you should download the gecko driver v0.18
  4. Code Steps:

    File firefoxDriver = new File(
            "gecko driver download");
    System.setProperty("webdriver.gecko.driver",
            firefoxDriver.getAbsolutePath());
    driver = new FirefoxDriver();
    driver.get("URL");
    
j.barrio
  • 1,006
  • 1
  • 13
  • 37
0

It seems that your geckodriver is not executable. Just navigate to the same directory where the goeckodriver placed and assign the read, write and execute permission for all.

enter image description here

Or other way to assign the permission from terminal is

navigate to directory and type chmod 777 geckodriver

NarendraR
  • 7,577
  • 10
  • 44
  • 82