0

I have tried

public void Login_PopUP()
    {   
    driver.get(url);
    driver.switchTo().alert();
    driver.findElement(By.id("userID")).sendKeys("domain/username");
    driver.findElement(By.id("password")).sendKeys("password");
    driver.switchTo().alert().accept();
    driver.switchTo().defaultContent();
  }

This is not working. I am not able to enter the input in the login alert pop up also username has a special character '\', how to handle it.

Can anyone help me with it?

Chris McCauley
  • 25,824
  • 8
  • 48
  • 65
  • At what point your script fails? What error are you getting? – Eugene S Sep 29 '14 at 08:21
  • Store username as variable and pass it to send keys instead of directly writing in the username in sendkeys – Vignesh Paramasivam Sep 29 '14 at 08:51
  • @Pooja I dont think there is any way to write in pop-up window by selenium , it only provides method to accept and reject the pop up boxes. Even if you want to write something there then please have a look here to get more details: http://stackoverflow.com/questions/11522434/how-to-handle-login-pop-up-window-using-selenium-webdriver – Priyanshu Sep 29 '14 at 08:54

1 Answers1

0

just pass the application URL with username & password as,

WebDriver driver = new FirefoxDriver();
driver.get("http://username:password@the-site.com");
Chetan
  • 2,360
  • 3
  • 18
  • 33