Here I am facing a problem with the authentication. Below are the steps I followed for authentication:
The problem is the opened browser window doesn’t load the page to enter the username and password. Its not doing anything. When I Disabled the forced-mode user. When I closed the previous window it opens another window and user gets logged in with script. But its keeps on opening multiple windows and doesn’t stop.
Here is my authentication Script:
var By = Java.type('org.openqa.selenium.By');
var Thread = Java.type('java.lang.Thread');
var extSel = org.parosproxy.paros.control.Control.getSingleton().
getExtensionLoader().getExtension(
org.zaproxy.zap.extension.selenium.ExtensionSelenium.class)
function authenticate(helper, paramsValues, credentials) {
print("Authenticating via JavaScript script...");
var msg = helper.prepareMessage();
var wd = extSel.getWebDriverProxyingViaZAP(1, "firefox");
wd.get("https://demo.testfire.net/login.jsp");
Thread.sleep(1000);
wd.findElement(By.name("uid")).sendKeys("admin")
wd.findElement(By.name("passw")).sendKeys("admin");
wd.findElement(By.name("btnSubmit")).click();
//Thread.sleep(1000);
helper.sendAndReceive(msg);
return msg;
}
// This function is called during the script loading to obtain a list of the names of the required configuration parameters,
// that will be shown in the Session Properties - Authentication panel for configuration. They can be used
// to input dynamic data into the script, from the user interface (e.g. a login URL, name of POST parameters etc.)
function getRequiredParamsNames(){
return [];
}
// This function is called during the script loading to obtain a list of the names of the optional configuration parameters,
// that will be shown in the Session Properties - Authentication panel for configuration. They can be used
// to input dynamic data into the script, from the user interface (e.g. a login URL, name of POST parameters etc.)
function getOptionalParamsNames(){
return [];
}
// This function is called during the script loading to obtain a list of the names of the parameters that are required,
// as credentials, for each User configured corresponding to an Authentication using this script
function getCredentialsParamsNames(){
return ["Username", "Password"];
}
Is anything wrong with my script? Can anyone provide the solution?
Regards,
Thoni