I tried Using below code but not worked.
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = driver.switchTo().alert();
alert.sendKeys("Uname" + Keys.TAB + "pwd");
alert.accept();
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityI tried Using below code but not worked.
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = driver.switchTo().alert();
alert.sendKeys("Uname" + Keys.TAB + "pwd");
alert.accept();
Verify the popup present after the landing page loaded,if popup presents use getcurrenturl
method and concatenate the username and password with the current url.
Use the below code it may work
driver.get('https://example.com/')
driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password");
driver.switchTo().alert().accept();