I have a script for creating a new account, and I need to specify the account name in the pop-up window and click "Ok".
I used the processing of robots in a pop-up window and when I run the script, the warning closes and a new account is created, but the following error appears:
org.openqa.selenium.UnhandledAlertException: unexpected warning is open (Session information: chrome = 46.0.2490.86) (Driver information: chromedriver = 2.9.248315, platform = Windows NT 6.3 x86_64)
(WARNING: the server did not provide any stack information )
I tried the code below:
driver.findElement(By.xpath("//*[@id='createAccount']/p")).click();
Thread.sleep(300);
Robot rb =new Robot();
rb.keyPress(KeyEvent.VK_O);
rb.keyRelease(KeyEvent.VK_O);
rb.keyPress(KeyEvent.VK_U);
rb.keyRelease(KeyEvent.VK_U);
Thread.sleep(200);
rb.keyPress(KeyEvent.VK_ENTER);
rb.keyRelease(KeyEvent.VK_ENTER);
Thread.sleep(400);
driver.findElement(By.id("passwd")).sendKeys("Abcd@123");
- , Google, .
:
Alert alt = driver.switchTo().alert();
alt.accept();
driver.switchTo().alert().accept();
:
org.openqa.selenium.WebDriverException: : : { "code": - 32603, "message": " JavaScript dialog" } ( : chrome = 46.0.2490.86) ( : chromedriver = 2.9.248315, = Windows NT 6.3 x86_64) (: )