Logging in
Logs in with a username and password. The login form is found automatically, or by the site marking its elements with data-elsetest-login attributes, which win over the selectors and auto-detection.
This is Elsetest's Login plugin. It runs as the instance Login.
In each step of a test, one plugin instance is picked at random, weighted by its frequency.
Options
Set them for one instance with --plugin alias=<alias> key=value, or for every instance of the plugin with --plugin name=Login key=value. In a config file, each --plugin is an object in "plugins", e.g.:
{
"plugins": [
{
"alias": "Login",
"username": "tester@example.com",
"password": "secret",
"openSelector": "#login-link"
}
]
}
A selector says which elements of the page an option is about, e.g. #chat-widget or .cookie-banner button: see Selectors.
frequency
--plugin alias=Login frequency=<level>
How often the plugin runs compared to the others.
openSelector
--plugin alias=Login openSelector=<selectors>
What to click to show the login form, typically a link or button, when it isn't on the start page: a CSS selector, or XPath prefixed with "xpath:"; several separated by ";" are clicked in turn (e.g. a menu, then its Login item). "?" finds a Log in/Sign in link or button. The site can also mark the elements in its HTML with the attribute data-elsetest-login-open.
usernameSelector
--plugin alias=Login usernameSelector=<selector>
The username field. Leave unset to auto-detect: the field immediately preceding the password field. The site can also mark the elements in its HTML with the attribute data-elsetest-login-username.
username
--plugin alias=Login username=<username>
The username for logging in.
passwordSelector
--plugin alias=Login passwordSelector=<selector>
The password field. Leave unset to auto-detect: the page's input[type=password]. The site can also mark the elements in its HTML with the attribute data-elsetest-login-password.
password
--plugin alias=Login password=<password>
The password for logging in.
submitSelector
--plugin alias=Login submitSelector=<selector>
The submit button for logging in. Leave unset to auto-detect: a submit button within the same form as the password field, falling back to pressing Enter. The site can also mark the elements in its HTML with the attribute data-elsetest-login-submit.
isLoggedInSelector
--plugin alias=Login isLoggedInSelector=<selector>
An element that is only on the page when logged in, visible or not, e.g. a Logout link in a closed menu (several separated by ";"). With it, the plugin only logs in when it is missing, and a login worked when it is there afterwards; without it, a login worked when the login form is gone afterwards. The site can also mark the elements in its HTML with the attribute data-elsetest-login-is-logged-in.
interactive
--plugin alias=Login interactive=true|false
Without a username and password, pause once so you can log in yourself in the browser (2FA too), then press Enter in the terminal. What you typed is reused to log in again later in the run.
maxFailedLogins
--plugin alias=Login maxFailedLogins=<number>
Stop the test (exit code 1) after this many failed logins in a row, e.g. with a wrong password; 0 never stops it.
Default instances
| Alias | The options it sets |
|---|---|
Login | frequency=normal |
Other plugins
Accessibility · Ai · BrokenText · Click · Cluster · History · MutationCluster · Overlap · Scroll · SelectOption · Spelling · Type · Validate
This page is generated from the help texts of Elsetest 0.9.8. The same help is in the program: elsetest --help.