0

Edit: The possible duplicates mentioned deals with how to pass credentials and login for Authentication pop ups. My questions here is how to Cancel the Authentication popup. Is it achievable trough Robot class? /Edit

I want to Cancel the below Authentication pop up. I tried using Robot class, but not able to Cancel the pop.

Also the code is working, i.e. I am not getting any error.

        Robot rb = new Robot();
        rb.keyPress(KeyEvent.VK_TAB);
        rb.keyRelease(KeyEvent.VK_TAB);
        Thread.sleep(2000);
        rb.keyPress(KeyEvent.VK_TAB);
        rb.keyRelease(KeyEvent.VK_TAB);

enter image description here

luator
  • 4,769
  • 3
  • 30
  • 51
Atul
  • 857
  • 8
  • 14
  • Possible duplicate of [How to Handle Browser Authentication popup using Selenium Webdriver](https://stackoverflow.com/questions/46219332/how-to-handle-browser-authentication-popup-using-selenium-webdriver) – Infern0 Oct 10 '19 at 09:29
  • @Infern0 Thanks for the suggestion. But my question here is around cancelling the Authentication pop up using keyboard event of Robot class. – Atul Oct 10 '19 at 09:37

2 Answers2

0

alert.accept() – Will click on OK button

alert.dismiss() – Will click on Cancel button

alert.text – will get the text which is present on the Alert

http://allselenium.info/python-selenium-handle-alerts-prompts-confirmation-popups/

  • The solution provided above works well with JavaScript/ Web based alerts. The question asked above is related to Windows based alerts. @Durga Prasad Behera Hence, the solution provided above is not working. – Atul Oct 10 '19 at 10:17
0

you can try using autoit to achieve your goal of interact with popup.

Software: https://www.autoitscript.com/site/

Here is an example usage: https://www.autoitscript.com/forum/topic/193594-windows-security-continues-to-pop-up-after-credentials-are-enterd/

Infern0
  • 2,565
  • 1
  • 8
  • 21