Reputation: 625
I'm having troubles with using PhantomJS with Watir-Webdriver. I have URLs with "http" scheme that return HTTP 301 Moved Permanently and redirect to a new "https" location. Two examples:
I wrote a script:
require 'watir-webdriver'
b = Watir::Browser.new :phantomjs, :args => ['--ignore-ssl-errors=true']
b.goto 'http://make.crowdflower.com'
puts b.title
puts b.url
b.close
The output is:
(empty line)
about:blank
The versions are: Ruby 2.1.0, watir-webdriver 0.6.11, phantomjs 1.9.7.
I wonder why is it happening. Any advice is much appreciated.
Upvotes: 2
Views: 1238
Reputation: 61912
The reason is very likely the POODLE vulnerability which forced websites to remove SSLv3 support. Since PhantomJS < v1.9.8 uses SSLv3 by default, the ssl handshake fails and the page doesn't load. You should set ssl-protocol
either to tlsv1
or any
:
require 'watir-webdriver'
b = Watir::Browser.new :phantomjs, :args => ['--ssl-protocol=tlsv1']
b.goto 'http://make.crowdflower.com'
puts b.title
puts b.url
b.close
PhantomJS 1.9.8 uses TLSv1 by default. See this answer for more up-to-date information. Note that there is a bug in 1.9.8 which might impact functionality. It is best to stick to 1.9.7 until 2.0 comes out.
Upvotes: 7