-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Najam Ul Saqib <[email protected]>
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This script can be used to fill in the OTP if it appears right after the authentication. | ||
// This can only work for the apps who have fixed OTP in MFA | ||
|
||
function browserLaunched(utils) { | ||
var By = Java.type("org.openqa.selenium.By"); | ||
var Thread = Java.type("java.lang.Thread"); | ||
var url = utils.waitForURL(5000); | ||
var wd = utils.getWebDriver(); | ||
var OTP = "123456"; | ||
|
||
wd.get(url + "#/login"); | ||
Thread.sleep(30000); //Wait for ZAP to handle the auth. | ||
wd.findElement(By.id("one-time-code")).sendKeys(OTP); | ||
wd.executeScript( | ||
"document.querySelector('flt-glass-pane').shadowRoot.querySelector('flt-semantics-placeholder').click({force: true})" | ||
); //Used with Flutter apps only | ||
Thread.sleep(1000); | ||
wd.executeScript( | ||
"document.querySelector('[aria-label=\"Verify Code\"]').click()" | ||
); | ||
} |