Using Java with Selenium and Eclipse and Chrome. I was on the page in Chrome I wanted to find an xpath for, so I did an inspect, and then right-click->copy->xpath and it returned the following:
//*[@id="queueForm"]/div[1]/span[3]/text()[2]
So I did a
// driver is an instance of ChromeDriver
String xp = "//*[@id="queueForm"]/div[1]/span[3]/text()[2]";
WebElement ele = driver.findElement(By.xpath(xp));
and I received an error message that that returned an object and not WebElement. Anyone run into this situation before? The HTML is like
<span class="displayOption" style="float:right;">
Page <input id="gotoresultpage" type="text" onkeypress="javascript:fncCaptureEnter(this);" size="1" maxlength="4" tabindex="1" value="1" class="navigationMenu" style="width:20px;text-align:right"> of 2
<input type="button" tabindex="1" value="Go" id="pageGo" name="pageGo" class="navigationButton" onclick="g_objQueueUiController.fncGo();">
<span class="recordNavigationBack"></span>
<span class="recordNavigationForwardEnabled" id="pageNext" name="pageNext" onclick="g_objQueueUiController.fncGoToPage('2')"></span>
</span>
You can see text "Page" in there and a bit later "of 2". The page number is in the input box.
So I am trying to get the "of 2" text. I already got the page number from the value of the input box, but not sure how to get the "of 2".