netsparker.
auth
Contains form authentication helper methods.
Methods
click(el, delayopt)
Simulates a click for the specified el.
Parameters:
Name Type Attributes Description
el string | The element to click.
HTMLElement
delay number <optional> The number of milliseconds (thousandths of a second) that the click should be delayed by. Note
that all delays are timed from the beginning of the script execution and does not work in
sequence if you have several function calls with delay.
Example
// Click element by id
[Link]('LoginButton');
// Click element by id after 2 seconds
[Link]('LoginButton', 2000);
// Click element by DOM element reference
[Link]([Link]('BUTTON')[0]);
clickByQuery(query, delayopt)
Simulates a click for the element specified by the CSS query.
Parameters:
Name Type Attributes Description
query string The CSS query that locates the element.
delay number <optional> The number of milliseconds (thousandths of a second) that the click should be delayed by. Note that all
delays are timed from the beginning of the script execution and does not work in sequence if you have
several function calls with delay.
Example
// Click element by using a complex CSS query
[Link]('#loginForm > div:nth‐child(2) > button');
// Click element by id
[Link]('#LoginButton');
// Click element by id after 2 seconds
[Link]('#LoginButton', 2000);
executeInFrame(frameEl, code, delayopt)
Executes the supplied code in specified frame element.
Parameters:
Name Type Attributes Description
frameEl string | The frame element id or DOM reference to execute code.
HTMLElement
code string The code to execute.
delay number <optional> The number of milliseconds (thousandths of a second) that the code execution should be
delayed by. Note that all delays are timed from the beginning of the script execution and does
not work in sequence if you have several function calls with delay.
Example
// Clicks an element inside a frame
var frame = [Link]('IFRAME')[1];
[Link](frame, '[Link]("LoginButton");');
log(message)
Logs a message.
Parameters:
Name Type Description
message string The message.
Example
// Log a simple message
[Link]('Hello world!');
login(usernameopt, passwordopt, delayopt)
Tries to find a login form and fill the specified credentials.
Parameters:
Name Type Attributes Description
username string <optional> The username to fill.
password string <optional> The password to fill.
delay number <optional> The number of milliseconds (thousandths of a second) that the login should be delayed by. Note
that all delays are timed from the beginning of the script execution and does not work in sequence
if you have several function calls with delay.
Example
// Login using hard‐coded values
[Link]('[Link]', 'p4ssw0rd');
// Login using hard‐coded values after 2 seconds
[Link]('[Link]', 'p4ssw0rd', 2000);
// Login using implicit credentials (current persona)
[Link]();
// Login using implicit credentials (current persona) after 2 seconds
[Link](2000);
setInputValue(el, value, delayopt)
Sets the value of specified el.
Parameters:
Name Type Attributes Description
el string | The element to click.
HTMLElement
value string The value to set.
delay number <optional> The number of milliseconds (thousandths of a second) that this set value operation should be
delayed by. Note that all delays are timed from the beginning of the script execution and does
not work in sequence if you have several function calls with delay.
Example
// Set value by id
[Link]('Username', '[Link]');
// Set value after 2 seconds
[Link]('Username', '[Link]', 2000);
// Set value by DOM element reference
[Link]([Link][0].elements[0], '[Link]');
setValueByQuery(query, value, delayopt)
Finds input element using the CSS query and sets its value.
Parameters:
Name Type Attributes Description
query string The CSS query that locates the element.
value string The value to set.
delay number <optional> The number of milliseconds (thousandths of a second) that this set value operation should be delayed
by. Note that all delays are timed from the beginning of the script execution and does not work in
sequence if you have several function calls with delay.
Example
// Query complex paths
[Link]('#loginForm > div:nth‐child(2) > input', '[Link]');
// Query by id
[Link]('#Username', '[Link]');
// Set value after 2 seconds
[Link]('#Username', '[Link]', 2000);