How to Handle Browser Authentication?
public void getWindowAuthentication()
{
System.setProperty("webdriver.chrome.driver", "C:\\Users\\****\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://the-internet.herokuapp.com/");
driver.findElement(By.linkText("Basic Auth")).click();
//Syntax
//http://Username:Password@siteURL
driver.get("http://admin:admin@the-internet.herokuapp.com/");
}
Comments
Post a Comment