I am trying to access a website located on my localhost. When I navigate to it, an alert appears and I have to authenticate, but when I use the method "authenticateUsing", it shows me that it does not exist. Can anyone help me?
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.navigate().to("http://localhost:8015/thing/Home");
String username = "a";
String password = "bbbbb";
WebDriverWait wait = new WebDriverWait(driver, 10);
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword(username, password));
This question does not provide enough information though. I will give you some Approaches :
Approach 1 :
You have to switch to alert box before you want to have interaction.
Then you can proceed further in your execution. Something like this after switching to alert :
Approach 2 :
Approach 3 : You may try AutoIT script. Please note that AutoIT script will work only in windows environment. However, I would not recommend you to go with this approach.