phantomjs (windows) hangs indefinitely on non responsive url http://localhost:1234

38 views
Skip to first unread message

fabienlroy

unread,
Aug 4, 2017, 5:32:51 AM8/4/17
to phantomjs
Hi,

The phantomjs version used:
S:\>phantomjs --version
2.1.1

The powershell script to create the server:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS S
:\> netstat -nat | grep 1234
PS S
:\> $listener = [System.Net.Sockets.TcpListener]1234
PS S
:\> netstat -nat | grep 1234
PS S
:\> $listener.Start();
PS S
:\> netstat -nat | grep 1234
  TCP    
0.0.0.0:1234           0.0.0.0:0              LISTENING       InHost

phantomjs test script:
var page = require('webpage').create();  
page
.settings.resourceTimeout = 5000; // 5 seconds
page
.onResourceTimeout = function(e) {
  console
.log(e.errorCode);   // it'll probably be 408
  console
.log(e.errorString); // it'll probably be 'Network timeout on resource'
  console
.log(e.url);         // the url whose request timed out
  phantom
.exit(1);
};

page
.open('http://localhost:1234', function (status) {
    console
.log('open ok');
}

It just hangs :(

Thanks.

Fabien
Reply all
Reply to author
Forward
0 new messages