NeerajPandey has asked for the wisdom of the Perl Monks concerning the following question:

I am running into an issue. I want to use WWW::Mechanize::PhantomJS. I have set it up as follow.
1. Installed Strawberry and WWW::Mechanize::PhantomJS Module
2.Downloaded PhantomJS zip, extracted it and set the path for phantomjs executable.
3. created a sample script as follow:

BEGIN{ $ENV{HTTPS_PROXY} = 'http://myproxyserver:port'; $ENV{HTTP_PROXY} = 'http://myproxyserver:port'; } use WWW::Mechanize::PhantomJS; use Data::Dumper; my $mech = WWW::Mechanize::PhantomJS->new(); $mech->get('http://google.com'); print Dumper $mech->content();
but when I execute this script I get the following error:
Selenium server did not return proper status at C:/Strawberry/perl/sit +e/lib/Selenium/Remote/Driver.pm line 395.
whats that I am missing. I assume that this WWW::Mechanize::PhantomJS starts phantomjs from path specified in environment.

Replies are listed 'Best First'.
Re: Selenium server did not return proper status
by Corion (Patriarch) on Dec 23, 2015 at 11:05 UTC

    The following script works for me and prints what could well be the Google home page:

    use strict; use WWW::Mechanize::PhantomJS; use Data::Dumper; my $mech = WWW::Mechanize::PhantomJS->new(); $mech->get('http://google.com'); print Dumper $mech->content();

    As there are many moving parts in your configuration, let's go through them:

    1. You say you installed PhantomJS after installing WWW::Mechanize::PhantomJS. This means that the test suite of the module could not actually check whether it can run a phantomjs executable. This is inconvenient. Please check that a phantomjs executable is actually visible in your PATH by opening a command line window and typing phantomjs in there. Please also tell us the version of the PhantomJS executable that is found and run.
    2. You are using a HTTP connection for a HTTPS proxy. Are you sure that the proxy is at the given address and that PhantomJS is happy with using a HTTPS proxy over HTTP? Can you run a test without needing a proxy?
    3. What versions of the modules (WWW::Mechanize::Firefox, Selenium::Remote::Driver) do you use?

      upon running phantomjs on cmd I can see a prompt 'phantomjs>'

      installed versions are as
      WWW::Mechanize 1.75
      WWW::Mechanize::Firefox 0.78
      WWW::Mechanize::PhantomJS 0.11
      Selenium::Remote::Driver 0.27
      proxy is correct as I use the same in browser.


      and even w/o proxy error remains same.