I
I
ifap2021-07-30 00:29:16
XPath
ifap, 2021-07-30 00:29:16

How to parse text after certain HTML code?

There is something like this code:

<div>Title 1 <i>Title 2</i></div>
<div>Text 1 <span>Text 2</span></div>


What goes before and after it is random and not unique, containers have no id, there are classes, but not unique, selection by the number of the child is impossible, because it changes on different pages, only the line is unique: Title 1 Title 2

Task: parse the value "Text 1 + Text 2", i.e. the instruction should look like "parse the text content of the div following the code: Title 1 Title 2 . But how to do it? The search did not bring an answer, because, apparently, I formulate the request incorrectly ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Fov, 2021-07-30
@ifap

//*[text()='Title'][1]/following-sibling::*[1]
If interested, then we study the XPath axes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question