I am facing an issue with a casperjs script:
var casper = require('casper').create();
console.log("casper create OK");
casper.start("https://my-ip/login_page.html", function() {
console.log("Connection URL OK");
// set a waiting condition to ensure the page is loaded (especially iframe in my case)
this.wait(5000,function(){
console.log("Wait for 5 sec OK");
//fill out the form
this.fillSelectors("form[name='lf']",{
'input#user' : "my_login",
'input#pass' : "my_password"
});
console.log("Providing login and password OK");
// click the login button
this.click("input[name='loginsub']");
console.log("Click on login button OK");
// switch to iframe (might not be required for most)
this.page.switchToChildFrame('mainframe');
console.log("Switch to iframe OK");
// Testing an area on the page to validate the connection
casper.waitForSelector('.area-status', function() {
console.log("Validation of element on the page OK");
});
});
});
// Check status of the general alarm
// Check status of the alarm zones
casper.run();
When I run my script, I encounter this error:
[root@srv-linux bin]# casperjs script.js
SyntaxError: Parse error
When I validate my script on , it shows no syntax errors.
This error occurs when I make changes to the script via WinSCP.
Could you assist me with resolving this issue?