Hi All,
I am getting following error message while trying to click on an element in a popup page. The details are provided below.
Error: Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//input[@id='lksrch']"}
Attachments:
1. Contains the screen shot of the application.
2. Another attachment to show the firepath xpath.
Information: Web Driver is able to locate all the objects in the parent window. And using my below mentioned code Web driver is able to recognize the popup window. But it is not locating any of the element in the popup screen using the xpath. I have tried with many combination to frame the xpath of the Go button. But it never worked at all. I don't have much knowledge on framing the xpath. Can you please suggest what could be the possible mistake I am doing. Is it in the xpath or something else.
The java code i am using to click on Go button in the popup page is:
public static WebDriver myWD,popup;
String xpath_gobutton;
xpath_gobutton = ".//*[@title='Go!']";
String currentWindow = myWD.getWindowHandle();
myWD.findElement(By.xpath(xpath_newCampaignLookup)).click();
Thread.sleep(4000L);
Set<String> availableWindows = myWD.getWindowHandles();
if (!availableWindows.isEmpty()) {
for (String windowId : availableWindows) {
if (count == 1){
System.out.println("Success");
System.out.println("all windows: " +windowId);
System.out.println("The title of the window is: "+myWD.switchTo().window(windowId).getTitle());
popup = myWD.switchTo().window(windowId);
popup.findElement(By.xpath(xpath_gobutton)).click();
break;
} else {
count = count + 1;
}
}
Thanks and Regards,
Sourav Mukherjee
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/USrHjysfBD4J.
For more options, visit https://groups.google.com/groups/opt_out.