-2

I have HTML like this:

<html>
    <table>
        <tr>
            <td id="tCell">Feb 2018</td>
        </tr>
    </table>
</html>

Here is XPath which returns me WebElement (SelenideElement in Selenide or Node in browser debugger): .//*[@id='tCell'] Here is XPath which returns me the String with Feb: substring-before(.//*[@id='tCell'], ' ')

My problem is that I need to receive the same Feb value, but as a Node.

Does someone have any ideas how to solve it?

0xFF
  • 585
  • 1
  • 6
  • 22

1 Answers1

0

There are two possibilities to get this certain td node:

Globally:

//td[@id='tCell']

And specifically:

/html/table/tr/td[@id='tCell']

Both do get the element node which text() sub-node has the content "Feb 2018".

zx485
  • 28,498
  • 28
  • 50
  • 59
  • Thank you for answer. The same thing I wrote in my question that I have already know how to receive especially this node. But I'm trying to get only part of text as a node. that's the point. – 0xFF Feb 14 '18 at 20:35
  • @0xFF: Sorry if I had misunderstood your question. But you cannot retrieve a substring as a node. That's simply impossible. You can only get it as a value (like: "Feb"). – zx485 Feb 14 '18 at 20:38