Use selenium in python
Post date: Apr 24, 2018 6:47:14 AM
I want to use Selenium to collect data and chrome is my browser of choice. I need to do a few things:
Install Selenium
$ pip install selenium
Install ChromeDriver on Mac
on mac is easy because you have "brew".
$ brew cask install chromedriver
==> Tapping caskroom/cask
Cloning into '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask'...
remote: Counting objects: 4054, done.
remote: Compressing objects: 100% (4025/4025), done.
remote: Total 4054 (delta 34), reused 1000 (delta 25), pack-reused 0
Receiving objects: 100% (4054/4054), 1.39 MiB | 0 bytes/s, done.
Resolving deltas: 100% (34/34), done.
Checking connectivity... done.
Tapped 0 formulae (4,062 files, 4.4MB)
==> Creating Caskroom at /usr/local/Caskroom
==> Satisfying dependencies
==> Downloading https://chromedriver.storage.googleapis.com/2.38/chromedriver_mac64.zip
######################################################################## 100.0%
==> Verifying checksum for Cask chromedriver
==> Installing Cask chromedriver
==> Extracting nested container chromedriver
==> Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'.
🍺 chromedriver was successfully installed!
The important part is here, you will need this when determine the webdriver.
Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'
Install ChromeDriver on other machines
To install ChromeDriver on other standalone machine, you will need something else.
Download chromedriver from this site: https://sites.google.com/a/chromium.org/chromedriver/downloads
Follow these steps to install chromedriver and add it to PATH visible for Selenium:
https://stackoverflow.com/a/24364290/1613297