I need to get DOM element by xpath. I got the answer from this link Is there a way to get element by XPath using JavaScript in Selenium WebDriver?. This function is not returning the exact results in the case when the element is hiddden(display:none).
In the example, I am trying out to get the first div content, But it is showing second div element it is taking hidden elements in to the count. I need to take hidden elements also in the count. Need help regarding this.