0

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();

Image

1

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.

e.g., http://Username:Password@CurrentURL

0

Use the below code it may work

driver.get('https://example.com/')
driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password");
driver.switchTo().alert().accept();
  • The above will work when the login is in basic url..but my authentication will come in after 1st page,the authentication url is dynamic based on search results – Sinu Reddy Mar 8 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.