0

I am using the latest version of selenium web driver and google chrome browser. In my app, after clicking on login button while dom is getting loaded I get a popup

image

I just want to close this popup without entering any value. I am using java for scripting. I tried javascript executor, all popup handlers from selenium but not able to close the same. I am not able to shift control on the popup window.

I google a lot but didn't found any relevant code

Javed Khan
  • 31
  • 10
  • 1
    Possible duplicate of [Selenium - Other way to basic authenticate than via url](https://stackoverflow.com/questions/45345882/selenium-other-way-to-basic-authenticate-than-via-url) – undetected Selenium Oct 17 '17 at 13:29
  • @DebanjanB thanks for reference. I am using post method for URL and my URL is like https://abcs.def.com/admin Though I tried it didn't work. still, I am getting the popup – Javed Khan Oct 17 '17 at 15:41

3 Answers3

0

This is a default behavior when using HTTP basic authentication. To stop this window to come you would need to send user and password in the request. Or as I understand from other response I found about this you can write:

driver.get("http://UserName:Password@Example.com");

There seems to be a similar issue, going on in thread: How to handle authentication popup with Selenium WebDriver using Java

bjozzi
  • 55
  • 3
  • 12
0

If all you want to do is "Cancel" the popup, instead of entering credentials. You may be able to just use this.

driver.switchTo().alert().dismiss();
IamBatman
  • 975
  • 12
  • 18
0

using AutoID was able to resolve above issue.

Refernce: http://learn-automation.com/handle-windows-authentication-using-selenium-webdriver/

Javed Khan
  • 31
  • 10