Monday, January 6, 2014

Handling Modal Pop Up Of an Web Page


We can see that some webpage show some banner, offer coupon or some registration form after page loaded and background page was disabled.

We choose "Jabong" for an example page to handle modal pop up.Some code is given below:

        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();
        driver.navigate().to("http://www.jabong.com/men/clothing/"
                + "?source=topnav");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println("Close the modal popup");
        driver.findElement(By.id("jab-vchr-cls")).click();


 

No comments:

Post a Comment