rubycapybarapoltergeist

"JQMIGRATE" error when visiting an https site with capybara and poltergeist in ruby program


I have a program

It was running fine about a year and a half ago when I last ran it, but running it now I get an error.

I have made a small program that demonstrates the error.

The program is-

 require 'capybara/poltergeist'
 session = Capybara::Session.new(:poltergeist)


print "visiting http://www.wikipedia.com \r\n"                                                                                                    


session.visit('http://www.wikipedia.com')

print "no error visiting http://www.wikipedia.com \r\n"                                                                                                    

print "visiting https://en.wikipedia.org/wiki/FIFA_World_Cup \r\n"                                                                                                    

session.visit('https://en.wikipedia.org/wiki/FIFA_World_Cup')

print "blah"  # prints blah so gets that far even though error from previous line.                                                                                                    

Before running the program i've set the path @PATH=%PATH%;c:\gecko;c:\Program Files (x86)\Mozilla Firefox;c:\phantomjs\bin

The path was always and is still fine.e.g. the first session.visit line (the one to http rather than https) works

C:\rubytest\wikipediathing\current>ruby wikipediatest2.rb
visiting http://www.wikipedia.com
no error visiting http://www.wikipedia.com
visiting https://en.wikipedia.org/wiki/FIFA_World_Cup
JQMIGRATE: Migrate is installed with logging active, version 3.0.1
This page is using the deprecated ResourceLoader module "schema.UniversalLanguageSelector".
See https://phabricator.wikimedia.org/T205744 for migration info.
blah
C:\rubytest\wikipediathing\current>

I went to https://phabricator.wikimedia.org/T205744 but it just talks about event logging so I don't see the applicability or any solution at that link.


Solution

  • You're not technically seeing an error there, you're seeing JS console log output from some of the libraries used on the page. Whether or not they are errors or just warnings is unclear from what you've shown, but it could very well be that wikipedia has upgraded the libraries used on the page to versions that no longer support the version of PhantomJS being used by Poltergeist. This can happen because PhantomJS development was stopped/abandoned due to QtWebKit no longer being developed. That has left Poltegeist/PhantomJS basically equivalent to a 6-7 year old version of Safari which is getting beyond the age where any website owner/developer really cares about supporting. Long term You're going to be much better off upgrading your program to using headless chrome via the selenium driver rather than the poltergeist driver.