0

I want to create sample script to login at my website.
My script like this :

var page   = require("webpage").create();
var system = require("system");
var data   = {
    "username": system.args[1],
    "password": system.args[2]
}

function login(data){
    page.open("http://localhost/mywebsite/login.php", function(){
        page.includeJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js", function(){
            console.log("Come in here.");
            phantom.exit();
        )}
    )}
}
login(data);

When I run phantomjs in terminal, example : phantomjs myscript.js admin admin
i dont get anything in my terminal.
what's wrong in my code?

1 Answer 1

1

The way you closing callbacks is wrong. you are closing like this )}.it should be });

Your code here

var page   = require("webpage").create();
var system = require("system");
var data   = {
    "username": system.args[1],
    "password": system.args[2]
}

function login(data){
    page.open("http://localhost/mywebsite/login.php", function(){
        page.includeJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js", function(){
            console.log("Come in here.");
            phantom.exit();
        });
    })
}
login(data);
Sign up to request clarification or add additional context in comments.

1 Comment

Thank You, Buddy!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.