Skip to content

Instantly share code, notes, and snippets.

@kelby
Last active January 26, 2017 02:23
Show Gist options
  • Save kelby/1d2feb43c59816b5abea682ccacd74e4 to your computer and use it in GitHub Desktop.
Save kelby/1d2feb43c59816b5abea682ccacd74e4 to your computer and use it in GitHub Desktop.
# Add Key:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# Set repository:
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# Install package:
sudo apt-get update
sudo apt-get install google-chrome-stable
sudo apt-get install chromium-chromedriver
sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/chromedriver
sudo add-apt-repository ppa:ubuntu-mozilla-daily/firefox-aurora
sudo apt-get update
sudo apt-get install firefox
gem install 'watir-webdriver'
gem install 'selenium-webdriver'
wget https://github.com/mozilla/geckodriver/releases/download/v0.13.0/geckodriver-v0.13.0-linux64.tar.gz
tar -xvzf geckodriver-v0.13.0-linux64.tar.gz
chmod +x geckodriver
cp geckodriver wires
sudo cp geckodriver /usr/local/bin
# export PATH=$PATH:/root/bin/wires
# export PATH=$PATH:/root/bin/geckodriver
# http://stackoverflow.com/questions/11494994/is-it-possible-to-plug-a-javascript-engine-with-ruby-and-nokogiri
sudo apt-get install xvfb firefox
gem install watir-webdriver headless
require 'rubygems'
require 'watir-webdriver'
require 'headless'
headless = Headless.new
headless.start
browser = Watir::Browser.new
browser.goto 'http://jsbin.com/ivihur' # our example
el = browser.element :css => '#hello'
puts el.text
browser.close
headless.destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment