How do I handle java script alert using WebDriver?


WebDriver would support handling js alerts using Alert interface.
                 // Bring control on already opened alert
          Alert alert = driver.switchTo().alert();
          // Get the text of the alert or prompt
          alert.getText();
// Click ok on alert
          alert.accept();
No comments :

No comments :

Post a Comment