WebFaction
Community site: login faq

Hi,

This isn’t a question.

I just want to share how to get a working headless watir-webdriver env set-up on webfaction.

I am assuming you already have a locally working ruby/gems set up.

i.e. so when you install gems they go into a locally writable path for only you to use.

Note: optional, install rbenv (helpful managing multiple local ruby versions if needed)

* download firefox and gecko driver

e.g. (any versions)

wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/45.0.2/linux-x86_64/en-US/firefox-45.0.2.tar.bz2

wget https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz

* extract them and put them in your PATH

Luckily Xvfb is installed and running on webfaction servers.

* gem install watir-webdriver (pulls in dependencies)

* gem install headless

file test.rb

require "rubygems"
require "headless"
require "watir-webdriver"

headless = Headless.new headless.start b = Watir::Browser.new :firefox b.goto 'http://google.com' puts b.text headless.destroy

$ ruby test.rb

Screen reader users, click here to turn off Google Instant.
Gmail
Images
Sign in
×
Get to Google faster. Switch your default search engine to Google.
Yes, show me
Privacy Terms Settings
Advertising Business About

Yes, really that is all there is to it!

This question is marked "community wiki".

asked 03 Nov '16, 07:13

dwright
5115
accept rate: 0%

edited 03 Nov '16, 07:15

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×2
×1
×1
×1
×1

question asked: 03 Nov '16, 07:13

question was seen: 2,647 times

last updated: 03 Nov '16, 07:15

Related questions

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2021 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM