Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Error “selenium server did not return proper status” when starts PhantomJS

by aitap (Curate)
on Oct 19, 2014 at 06:49 UTC ( [id://1104289]=note: print w/replies, xml ) Need Help??


in reply to Error “selenium server did not return proper status” when starts PhantomJS

As far as I understand, "Selenium server did not return proper status" happens in the Selenium::Remote::RemoteConnection class. Here is how we can try to get more information on this problem:

  1. perldoc -l Selenium::Remote::RemoteConnection to display the file name of the module
  2. perl -d yourprogram.pl
  3. f path/to/Selenium/Remote/RemoteConnection.pm
  4. Use l command to view the source and b command to place a breakpoint before croak "Selenium server did not return proper status";
  5. c to run the program; after it stops on the brakepoint, use x to examine values of variables and expressions. Does Selenium client really connect where it is supposed to (localhost:8190)? What is returned in $status object?

I had a problem with Selenium client incorrectly guessing that I have a webdriver running and trying to connect to my I2P instance.

Replies are listed 'Best First'.
Re^2: Error “selenium server did not return proper status” when starts PhantomJS
by keplerbr (Initiate) on Oct 19, 2014 at 15:56 UTC

    Apparently, I had problems with the command "f".

    C:\Users\macabeus>cd C:\Users\macabeus\Desktop\bvubot C:\Users\macabeus\Desktop\bvubot>perldoc -l Selenium::Remote::RemoteCo +nnection C:\Strawberry\perl\site\lib\Selenium\Remote\RemoteConnection.pm C:\Users\macabeus\Desktop\bvubot>perl -d test.pl Loading DB routines from perl5db.pl version 1.44 Editor support available. Enter h or 'h h' for help, or 'perldoc perldebug' for more help. main::(test.pl:6): my $phantom = WWW::Mechanize::PhantomJS->new(l +og => 'DEB UG'); DB<1> f C:\Strawberry\perl\site\lib\Selenium\Remote\RemoteConnection +.pm No file matching 'C:\Strawberry\perl\site\lib\Selenium\Remote\RemoteCo +nnection.p m' is loaded. DB<2> f path/to/Selenium/Remote/RemoteConnection.pm No file matching 'path/to/Selenium/Remote/RemoteConnection.pm' is load +ed. DB<3> l 6==> my $phantom = WWW::Mechanize::PhantomJS->new(log => 'DEBUG'); 7 8: 1; DB<3> b DB<3> b 7 Line 7 not breakable. DB<4> b 8 DB<5> c [DEBUG - 2014-10-19T15:37:47.819Z] Config - config.init - {"ip":"127.0 +.0.1","por t":"8910","hub":null,"logFile":null,"logLevel":"DEBUG","logColor":fals +e} [INFO - 2014-10-19T15:37:47.897Z] GhostDriver - Main - running on por +t 8910 Selenium server did not return proper status at (eval 54)[C:/Strawberr +y/perl/ven dor/lib/Sub/Quote.pm:5] line 61. at C:/Strawberry/perl/site/lib/WWW/Mechanize/PhantomJS.pm line 214. WWW::Mechanize::PhantomJS::new("WWW::Mechanize::PhantomJS", "l +og", "DEBU G") called at test.pl line 6 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<5> x 0 0 DB<5> q C:\Users\macabeus\Desktop\bvubot>

    I'm unsure how I can test the connection, because the program results in problems during the construction of the object of PhantomJS

      No file matching 'C:\Strawberry\perl\site\lib\Selenium\Remote\RemoteConnection.pm' is loaded.
      Does f C:/Strawberry/perl/site/lib/Selenium/Remote/RemoteConnection.pm not work, either? The idea was to examine the variables $self and $status near the place of the error (sub BUILD in RemoteConnection.pm, lines 44-49 in my installation).

        Sorry for slow poke ...

        So I stumbled accross this thread because I have the same problem. And an ugly fix/work-around. Can't do any better because I don't know anything about perl.

        1. Open StrawberryPerl\perl\vendor\lib\LWP\Protocol\http.pm
        2. Find sub _new_socket
        3. Set $host = '127.0.0.1' (maybe '::1' works, too?)

        How did I find this solution? The debugging helped. The error reported by IO::Socket::INET is "bad address". Originally the host was "localhost". I have no idea why "localhost" is a bad address but "127.0.0.1" works.

        For reference:

        • nslookup localhost = no result
        • ping localhost = ::1
        • http://localhost:8910/ in browser opens as expected
        • Windows 10, 64bit
        • perl v5.22.0 MSWin32-x64-multi-thread
        • Several network cards/adapters but only one enabled
        • IPv4 and IPv6
        • Default Windows Firewall
        • Avast Free AntiVirus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104289]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found