Tuesday, 11 September 2012

Selenium WebDriver – Handling JavaScript Popups

Selenium WebDriver – Handling JavaScript Popups

public class HandlingPopup  {

static WebDriver driver = new FirefoxDriver();

 public static void Handle(){

//switching focus to alert box
Alert alert =driver.switchTo().alert();

//Get text from the alert box
 System.out.println(alert.getText());

//click on Ok

 alert.accept();

//cancel the popup

driver.quit();

public static void main(String args[]){

 Handle();

 }
}

6 comments:

  1. < a href " https://astrologyrays.com/ " > Best Astrologer in Jaipur

    ReplyDelete
  2. Great job! This is one of the most informative articles I've read recently.microsoft devops course

    ReplyDelete
  3. If you're searching for the best power bi online training, OnlineITGuru provides a good balance of theory and hands-on practice. Their live sessions help learners gain confidence with Power BI tools.best power bi online training

    ReplyDelete
  4. A Tableau Online Course is perfect for professionals who want to upgrade their data visualization skills while managing their work schedules. The flexibility of online learning combined with hands-on assignments allows learners to gain practical knowledge and confidence. Choosing a course that offers certification preparation can further enhance career prospects.tableau online course

    ReplyDelete
  5. I like the practical approach discussed in this post. Choosing an online tableau course with real-world exercises can help learners gain confidence while working with datasets and creating interactive visualizations. Very useful resource.online tableau course

    ReplyDelete
  6. An Oracle SOA course helps learners build practical expertise in service-oriented architecture and enterprise application integration. This oracle soa course covers BPEL, Mediator, adapters, composite applications, web services, and deployment. Students gain hands-on experience through real-time projects and practical assignments.

    ReplyDelete