Hi All,
From google search result I want to to click a link. I find the element by xpath but its unable to locate.
For the same i written following code:
WebDriver driver=new FirefoxDriver();
List<WebElement> btns=driver.findElements(By.tagName("button"));
for(WebElement btn : btns)
System.out.println(btn.getAttribute("aria-label"));
driver.findElement(By.id("gbqfq")).sendKeys("
naukri.com");
driver.findElement(By.id("gbqfb")).click();
driver.findElement(By.xpath("html/body/div[1]/div[3]/div[2]/div[6]/div[1]/div[4]/div/div[2]/div[2]/div/ol/li[1]/div/div/h3/a/em[1]")).click();
But its reflect following Error in console:
Unable to locate element: {"method":"xpath","selector":"html/body/div[1]/div[3]/div[2]/div[6]/div[1]/div[4]/div/div[2]/div[2]/div/ol/li[1]/div/div/h3/a/em[1]"}
Command duration or timeout: 29 milliseconds
Plz solve it...