Hi everyone! I’m new here.
I’m trying to automate a login test on Microsoft Authentication Library (MSAL).
I’m new to appium and I’m trying to understand why this test is flakey.
I get this error from the server:
Send a sequence of keystrokes to the active element.[“[email protected]”]
An element could not be located on the page using the given search parameters
when trying to perform:
// Tapping E-mail …
t.tap(PointOption.point(263, 607)).perform(); // tapping the email/password field: a desperate move …
Thread.sleep(10000);
System.out.println(“Typing E-mail …”);
driver.getKeyboard().pressKey(account); // not working, why?
Thread.sleep(10000);
The code of the test is below:
public static boolean loginTest(AndroidDriver driver, String account, String password) throws InterruptedException {
Thread.sleep(10000);
// Attempting to Login ...
TouchAction t = new TouchAction((PerformsTouchActions) driver);
// Tapping Sign-In Button ...
System.out.println("Tapping the Sign-In Button ...");
By signInButton = By.id("signIn");
driver.findElement(signInButton).click(); // this works ...
// t.tap(PointOption.point(539, 2064)).perform(); // Tapping the sign-in button: a desperate move … this is flakey! why?
Thread.sleep(10000);
// Tapping E-mail ...
t.tap(PointOption.point(263, 607)).perform(); // tapping the email/password field: a desperate move ...
Thread.sleep(10000);
System.out.println("Typing E-mail ...");
driver.getKeyboard().pressKey(account); // not working, why?
Thread.sleep(10000);
// Tapping Next ...
t.tap(PointOption.point(837, 1006)).perform(); // Tapping next: a desperate move ...
Thread.sleep(10000);
// Tapping Password ...
System.out.println("Tapping Password ...");
driver.getKeyboard().pressKey(password); // not working, why?
Thread.sleep(10000);
// ...
driver.getKeyboard().pressKey(Keys.ENTER);
Thread.sleep(10000);
String syncActivity = ".Sync";
// Return true if login was performed successfully ...
return (Objects.equals(driver.currentActivity(), syncActivity));
}
Thank you.