I launched website http://the-internet.herokuapp.com/ and click the 2 link Basic Auth (user and pass: admin). a javascript prompt box appear which asked me to login . how to automate with selenium . i tried below code .
System.setProperty("webdriver.chrome.driver", "E:\\Driver\\chromedriver.exe");
System.setProperty(ChromeDriverService.CHROME_DRIVER_LOG_PROPERTY, "null");
System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");
ChromeOptions op=new ChromeOptions();
op.addArguments("--disable--notifications");
op.addArguments("disable-infobars");
WebDriver driver=new ChromeDriver(op);
driver.get("http://the-internet.herokuapp.com/");
driver.manage().window().maximize();
driver.findElement(By.xpath("//a[contains(.,'Basic Auth')]")).click();
Thread.sleep(10000);
Alert alert=driver.switchTo().alert();
alert.sendKeys("admin");
alert.sendKeys("admin");
alert.accept();
Instructor
Ashish Thakur Replied on 15/03/2019
You have to manage it using AutoIT or Robot class.
Hi Ashish ,
I have tried with AutoIT , It recognizes all element as intermediate D3D windows and not able to perform any action .kindly help me .
Regards
Suhail
Instructor
Ashish Thakur Replied on 18/03/2019
Please try using robot class