Search code examples
javaseleniumselenium-webdriverpopuppopupwindow

How to send username and password in popup box through selenium in java?


Click the link to see: pop up screenshot

I am trying to automate this:http://the-internet.herokuapp.com/basic_auth in chrome using Selenium java. I want to insert username, passwors and then either click sign in or cancel. But I am not able to "inspect element".


Solution

  • It is window authentication pop-up, not javascript alert. So, in this case you need to modify Webdriver URL. (AutoIT also can be applicable. But below is the simple way to handle it.)
    say, username=admin, password=admin. Just pass the below URL:

    driver.get("http://admin:[email protected]/);