How do I handle the login pop up window using Selenium Webdriver 4.0 beta? Here's my scenario:
- Navigate to web app.
- Web app detects I am not logged in, and redirects to an SSO site
- SSO site then detects I am not logged in, and shows a login popup window.
- Redirected back to web app on successful login.
P.S.: I have tried the different solutions offered in previous similar questions but nothing seems to work for me. Code below (I am quite new to Selenium testing so any pointers will be appreciated).
public class LoginTest {
public static void main(String[] args){
//Setting the driver path
System.setProperty("webdriver.chrome.driver", "C:\\path");
//Creating WebDriver instance
WebDriver driver = new ChromeDriver();
//Navigate to web page
driver.get("https://url");
//Maximising window
driver.manage().window().maximize();
//Locating web element
WebElement username = driver.findElement(By.id("email"));
WebElement password = driver.findElement(By.name("password"));
WebElement login = driver.findElement(By.name("submit"));
//Performing actions on web elements
username.sendKeys("email");
password.sendKeys("password");
login.click();
//Closing browser session
driver.quit();
}
}