Reputation: 1
I have a site https://www.example1.com Through selenium I need to visit the site and check for something. The site has SSO, and I have access to the site.
However, when i try visiting the through selenium, I get automatically redirected to a different link, and I am prompted to enter credentials in an alert dialog box.
Now how do I automatically pass my credentials through code? I have tried sending the credentials in the following manner but it did not work.
https://username:[email protected]
Another point to note is that, when i visit the site manually through chrome, the site opens up and no authentication prompt pops up.
Upvotes: 0
Views: 1331
Reputation: 3384
If you want to provide username and password on alert pop up then you can try following code:
alert.sendKeys("UserName");
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
alert.sendKeys("Password");
alert.accept();
Upvotes: 1