Getting about:blank

23 views
Skip to first unread message

Arpan Mukhopadhyay

unread,
Oct 30, 2019, 1:13:31 PM10/30/19
to phantomjs
Hello,

I have been trying to capture one page using phantomjs.exe which has a browser authentication as a popup. The credential is as below - 

Username - admin
Password - P@ssw0rd#!

Here is the code that I was using - 

var page = require('webpage').create();
var username = "admin";
var password = "P@ssw0rd#!";
var url = "http://" + username + ":" + password + "@localhost:8080/";
page.open(urlfunction (status) {
    function checkReadyState() {
        setTimeout(function () {
            var readyState = page.evaluate(function () {
                return document.readyState;
            });
            console.log(readyState);
            if ("complete" === readyState) {
                console.log(page.url);
                page.render('screenshot.png');
                clearTimeout();
                phantom.exit();
            } else {
                checkReadyState();
            }
        }, 10000);
    }
    checkReadyState();
});

But it reruns an empty screenshot of 1 KB and not other error is showing up. But if I change the credential to below -

Username - admin
Password - admin

Then the above code works fine and the screenshot also gets captured. So it seems like the special characters in the earlier password (P@ssw0rd#!) is messing up. Is there any way to use special characters in the password while using phantomjs ?

Additionally I have tried the below and none of it worked - 

var username = "admin";
var password = "P@ssw0rd#!";

var url = "http://" + encodeURI(username + ":" + password) + "@localhost:8080/";


var username = "admin";
var password = "P@ssw0rd#!";

var url = encodeURI("http://" + username + ":" + password + "@localhost:8080/");


var username = "admin";
var password = "P%40ssw0rd%23%21";

var url = "http://" + username + ":" + password + "@localhost:8080/";

I am using the latest phantomjs.exe
Reply all
Reply to author
Forward
0 new messages