0

I have a html structure like this:

<div>
  My text
  <span class="c">Some other text I dont want</span>
</div>

In selenium how do I only get the direct child text of the div, in this case My text.

If I use element.getAttribute("innerText") I get this:

My textSome other text I dont want

Is there an elegant way to do this?

IceRevenge
  • 1,144
  • 14
  • 27

0 Answers0