----------------------Here is my code snippet------------
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class MakeMyTrip1 {
public static void main(String[] args) {
WebDriver webdriver = new FirefoxDriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.get("http://makemytrip.com"); webdriver.findElement(By.cssSelector(".wewidgeticon.we_close.icon-large")).click();
//webdriver.findElement(By.xpath("//*[@id='webklipper-publisher-widget-container-notification-close-div']/span/i"));
/*System.out.println("WINDOW"+webdriver.getWindowHandle());
Set<String> set = webdriver.getWindowHandles();
System.out.println("Count:"+ set.size());
*/
}
}
*************Throwing below exception*********
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":".wewidgeticon.we_close.icon-large"}
Command duration or timeout: 10.26 seconds
use this
[code:31imv7oi]package com.sample;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class MakeMyTrip1 {
public static void main(String[] args) throws InterruptedException {
WebDriver webdriver = new FirefoxDriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.get("http://makemytrip.com");
Thread.sleep(5000);
webdriver.switchTo().frame("webklipper-publisher-widget-container-notification-frame");
webdriver.findElement(
By.cssSelector(".wewidgeticon.we_close.icon-large")).click();
// webdriver.findElement(By.xpath("//*[@id='webklipper-publisher-widget-container-notification-close-div']/span/i"));
/*
* System.out.println("WINDOW"+webdriver.getWindowHandle()); Set<String>
* set = webdriver.getWindowHandles(); System.out.println("Count:"+
* set.size());
*/
}
}
[/code:31imv7oi]
Thanks you soo much. could you please explain in details like , how did you figure it out ifit is a frame ? i tried finding using firebug/source code of the page also , but couldnt get "webklipper-publisher-widget-container-notification-frame" element.
are there any steps we need to consider incase of these types of widgets? Thanks in anticipation.