1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python selelnium help.

Discussion in 'General Programming Chat' started by Google Prince, May 12, 2016.

  1. Google Prince

    Google Prince Jr. VIP Jr. VIP

    Joined:
    Dec 24, 2015
    Messages:
    171
    Likes Received:
    110
    Location:
    Google's Search Engine
    I'm kind of a beginner programmer as I've dabbled with python on/off for about a year but recently really wanna commit myself to developing bots that automate some of my money making task.

    So I got introduced to selenium. When trying to execute "driver = webdriver.Chrome()" for example I keep getting an error saying "executable needs to be in PATH."

    I did some research & someone suggested I need to download and put the executable in the path. Then use the driveras normal.

    I downloaded the executable but don't understand if I'm putting it in the right PATH or what? I'm still getting error.

    I'm using Mac btw with python 3.5
     
  2. nsxbl28

    nsxbl28 Newbie

    Joined:
    Mar 12, 2014
    Messages:
    28
    Likes Received:
    2
    Gender:
    Male
    Location:
    Spain
    Hello GooglesMyBtch!

    First of all, I am not an expert. I am replying you because no body has done it yet and maybe you are in a hurry. Let's see if I can!

    Have you tried to change the content of webdriver.Chrome() writing the path? For example:

    driver = webdriver.Chrome("C:/Users/YOU/.../chromedriver_win32/chromedriver.exe").

    I think it could be your problem. I guess that other python scripts works properly for you, right?
     
  3. yellowcat

    yellowcat Regular Member

    Joined:
    Aug 27, 2015
    Messages:
    305
    Likes Received:
    176
    Location:
    internet 24/7
    Home Page:
    driver = webdriver.Firefox()
    Really no point in using chrome "shrugs"
     
    • Thanks Thanks x 2
  4. Google Prince

    Google Prince Jr. VIP Jr. VIP

    Joined:
    Dec 24, 2015
    Messages:
    171
    Likes Received:
    110
    Location:
    Google's Search Engine
    yes I have and also get the error "executable may have wrong permissions."

    but it doesn't have wrong permissions which I made sure to change.
     
  5. Google Prince

    Google Prince Jr. VIP Jr. VIP

    Joined:
    Dec 24, 2015
    Messages:
    171
    Likes Received:
    110
    Location:
    Google's Search Engine
    lol got it to work with firefox but can't get it to work with Opera or Chrome.
     
  6. Buzzika

    Buzzika Senior Member

    Joined:
    Jul 8, 2009
    Messages:
    1,197
    Likes Received:
    1,481
    Occupation:
    Hustler
    Location:
    Gurgaon
    1. Download the ChromeDriver executable.
    2. Either create your own PATH to a unique folder on your mac or copy the file to an existing PATH directory. To do this:
      1. Open up Terminal
      2. Run sudo nano /etc/paths in the OSX terminal
      3. Enter your password
      4. Go to the bottom of the file and enter the path you wish to add
      5. My PATH looks like: /Users//Documents/WebDriver
      6. Control-x to quit
      7. Y to save
    3. To double check, quit Terminal and relaunch it. Run echo $PATH. You should see your newly added path in the stream of other paths already there.
    4. Finally, update your tests to run using ChromeDriver (include code snippet) and run your tests!

    EDIT: Personally I prefer to use Chrome. I was a long supporter of f'fox... but for some weird reason Firefox was throwing errors for a selenium bot I made for etsy.com. However when I ran the same code with chromedriver instead it worked flawlessly.

    One more thing, if you are not already using homebrew then you should. It saves me a ton of time and headache when managing my dev environment.
     
    Last edited: May 12, 2016