I'm having an issue when doing automation development.
1 - Browsing URL 1
2 - It's automatically redirected to URL 2
3 - Having HTTP/ Basic Authentication
I had played around with for the whole days but there was no luck to bypass this popup. Tried:
i - Chrome Arguments
ii - Embedded Username/Password onto 1URL
iii - Robot
iv - switch to alert() setAuthentication/sendkeys
Appreciated your advices
PS: Think about handling it using AutoIt or Sikuli. However, I'd love to know how to handle it without using 3rd parties.
Code Snipet used
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
long startTime = System.currentTimeMillis();
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("ignore-certificate-errors");
options.setAcceptInsecureCerts(true);
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.get("http://username:password@URL1");
// Being redirected to URL2
// Stucked forever at HTTP/ Basic Authentication
driver.findElement(By.id("username")).sendKeys("username");
driver.findElement(By.id("password")).sendKeys("password");
driver.findElement(By.id("kc-login")).click();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.close();
}
}