WebDriver->I am trying to capture the ‘date’ selected from a UI-Calender. I want to find the ‘date’ element selected using javascript.For which I used the following :
WebElement element = (WebElement) ((JavascriptExecutor)driver).executeScript("return $('#abc')");
String s=element.getAttribute("value");
System.out.println(" "+s);
But strangely when I add the above lines, Firefox stops responding, then script stops working .Version firefox:3.6
That’s because
return $('#abc')returns an array of DOM elements. You should usereturn $('#abc')[0].