Reputation: 95
In my test i must verify that the text of the Button is written in two lines: Example: Line 1 Line 2
<div class="ClassName">
Line 1
<br/>
<br/>
Line 2
</div>
The only Solution that I find is to verify that this balise contain the two texts et it work but that didn't verify that the text is written in two lines.
The xpath that I use is the folowing:
.//div[text()[contains(.,"Line 2")] and text()[contains(.,"Line 2")]]
Thanks!
Upvotes: 0
Views: 950
Reputation: 1463
Using your example, you could use the following xpath to only get the div
if the div
contains the text 'Line 1' and 'Line 2' and more than one br
tag
//div[contains(., 'Line 1') and contains(., 'Line 2') and count(br) > 1]
Upvotes: 1