How to install selenium with python
Download and use Chrome. If you already have Chrome, update it to the latest version.
Download ChromeDriver, download the latest one. To see what version of chrome you have, open up Chrome if you aren’t already using it (your browser, not chrome driver). Bring your mouse to the top left of your computer screen to the menu options, click on Chrome, then click on “About Google Chrome”.
Now open up terminal:
First install pip by typing or copying the following in Terminal then click enter: (if you don’t have pip already)
sudo easy_install pip
It may ask for your password, type your computer’s password. Click enter. When its done, the cursor will return.
Type or copy and paste the following in Terminal then click enter:
pip install selenium
Since we are in the terminal lets move chromedriver to a better location. Type or copy and paste the following line into terminal and click enter.
mv ~/Downloads/chromedriver /usr/local/bin
Then open Pycharm if you have that.
Choose Python 3. If you have Python 2. you should definitely update to Python 3.
Now, click the plus sign. It should be selectable after you choose an interpreter.
When you use the .py file ending, the python interpreter knows to treat the text you write as Python code.
Type or paste the following code into your file.
from selenium import webdriver
Now type or copy the following code into your file:
driver = webdriver.Chrome("")
It should look something like this:
Now open up Finder.
Right click on chromeDriver. Click ‘alt’ and then you can click on copy “chromedriver” as pathname
You can’t see it yet, but now you have copied the path to your chrome driver to your pasteboard.
Now go back to your code and paste the path you copied between the empty quotes:
driver = webdriver.Chrome("") # <- paste between the quotes.
Now right click the empty space of your Pycharm file, anywhere under the code you wrote, and then choose run automation.
Wait a minute for chrome to open. Congrats you just ran an automated Script and opened Google with it!