Fix issue with overlapping WebElements in SocialLoginTest#PaypalLogin
Closes #23960
This commit is contained in:
parent
427cd4b290
commit
b5ec155b64
1 changed files with 10 additions and 6 deletions
|
@ -17,12 +17,12 @@
|
|||
|
||||
package org.keycloak.testsuite.pages.social;
|
||||
|
||||
import org.keycloak.testsuite.util.WaitUtils;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import static org.keycloak.testsuite.util.UIUtils.clickLink;
|
||||
|
||||
/**
|
||||
* @author Petter Lysne (petterlysne at hotmail dot com)
|
||||
*/
|
||||
|
@ -44,23 +44,27 @@ public class PayPalLoginPage extends AbstractSocialLoginPage {
|
|||
|
||||
@Override
|
||||
public void login(String user, String password) {
|
||||
JavascriptExecutor executor = (JavascriptExecutor) driver;
|
||||
try {
|
||||
usernameInput.clear(); // to remove pre-filled email
|
||||
usernameInput.sendKeys(user);
|
||||
|
||||
WaitUtils.pause(3000);
|
||||
try {
|
||||
clickLink(nextButton); // sometimes the login process is just a one step,
|
||||
// sometimes it's two steps so we need to click the 'Next' button
|
||||
executor.executeScript("arguments[0].click();", nextButton); // sometimes the login process is just a one step,
|
||||
// sometimes it's two steps so we need to click the 'Next' button
|
||||
}
|
||||
catch (NoSuchElementException e) {
|
||||
// one step login process, no need to click the 'Next' button
|
||||
}
|
||||
|
||||
passwordInput.sendKeys(password);
|
||||
clickLink(loginButton);
|
||||
WaitUtils.pause(3000);
|
||||
executor.executeScript("arguments[0].click();", loginButton);
|
||||
}
|
||||
catch (NoSuchElementException e) {
|
||||
clickLink(continueLoginButton); // already logged in, just need to confirm it
|
||||
WaitUtils.pause(3000);
|
||||
executor.executeScript("arguments[0].click();", continueLoginButton); // already logged in, just need to confirm it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue