simply clone this repo and start surfing 😉
all the ruby it takes, it as simple as this demo
# load object
require_relative '../headless-chrome-browser/headless_chrome_browser'
# setup headless selenium / chrome
headless_browser_master = HeadlessChromeBrowser.new
# init new browser window
browser = headless_browser_master.new_browser
# visit google
browser.goto('http://www.google.com')
# scrape content with nokogiri
html_content = Nokogiri::HTML(browser.html)
title = html_content.css("title").text
puts "This website's title is: #{title}"
# close your browser, always tidy up ;-)
browser.close
- clone this repo
- navigate to the directory with your terminal
$ docker image build . -t headless-watir-ruby
$ docker run --rm headless-watir-ruby
if you changed the code in your main.rb? no problem, build the image again ($ docker image build . -t headless-watir-ruby
) before running it 😉