Open andygrunwald opened 6 months ago
Usecase: When you login into GitHub, sometimes a "Is your phone number up to date?" or "Are your 2FA settings still the way to go?". In these forms, the URL is not changing.
This can be tested via the Github recipe:
{
"supplier": "github",
"domains": [
"github.com"
],
"type": "browser",
"steps": [
{
"action": "open",
"url": "https://github.com/login",
"description": "Open the login page."
},
{
"action": "type",
"selector": "#login_field",
"value": "{{ username }}",
"description": "Insert login email."
},
{
"action": "type",
"selector": "#password",
"value": "{{ password }}",
"description": "Insert password."
},
{
"action": "click",
"selector": "//input[@type='submit']",
"description": "Click on continue."
},
{
"action": "waitFor",
"selector": "#app_totp",
"description": "Wait for the 2FA code input field.",
"when": {
"url": "https://github.com/sessions/two-factor/app"
}
},
{
"action": "type",
"selector": "#app_totp",
"value": "{{ totp }}",
"description": "Insert the 2FA code (if required)",
"when": {
"url": "https://github.com/sessions/two-factor/app"
}
},
{
"action": "waitFor",
"selector": "//input[@value='Remind me later' or @value='Ask me later']",
"description": "Wait for security settings screen",
"when": {
"url": "https://github.com/sessions/trusted-device"
}
},
{
"action": "click",
"selector": "//input[contains(., 'me later')]",
"description": "Click remind me later or ask me later button",
"when": {
"url": "https://github.com/sessions/trusted-device"
}
},
{
"action": "waitFor",
"selector": "//a[@href='/logout']",
"description": "Wait for logout link"
},
{
"action": "open",
"url": "https://github.com/account/billing/history",
"description": "Open the billing history page."
},
{
"action": "downloadAll",
"selector": "//a[contains(@id,'download-receipt')]",
"description": "Download all invoices."
}
]
}
We need this to check if an element exists and a step should be executed or not.
example code:
Example (github recipe):