Home computickets Xpath text ()

Xpath text ()

Author

Date

Category

Hello.

Tell me how to find a tag by text inside, if some of the information is dynamic.

I understand how to find statics:

& lt; body & gt;
  & lt; a href = "#" & gt; Link & lt; / a & gt;
& lt; / body & gt;

Xpath:

// body / a [text () = "Link"]

What if I only know part of the text?

Thank you.


Answer 1, authority 100%

So:

// body / a [text () [contains (., 'Link')]]

Answer 2, authority 17%

You can use the following option, it searches for all “a” tags that contain “part of the text” // a [contains (text (), 'part of the text')]

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions