0

I want to get the text which is splitted into multiple tags and regroup it in one webelement (as follows):

<h2>Title</h2>
<h3>A.     first header </h3>
<p>This is the first line text.</p>
<h3>B.     second header</h3>
<p>
    <span class="bold">text2 in bold</span>  and the rest of the text line.
</p>
<p>
    <span class="bold">text3 in bold</span>  and the rest of the text line.
</p>

Thus to verify the content of all tags in one go (compare with one constant for example).

Thanks for helping.

1

Don't try to match all at once , write a subroutine that starts by matching the first value , then looks for the nth until it has all the values, then returns the concatenated values.

Its tempting to try an write an XPath statement that will match all three but this wont have useful failure modes (e.g. it will pass or fail but not show how close it got) and will be fragile to changes.

In your subroutine match by unique ID and push back to the developers if they reuse ID's. If you do this in a subroutine it can log when it finds the elements and what the values are , this will help you diagnose any failures and spot near misses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.