<div class="o-text99">
"No "
"messages"
" found"
</div>
I want to identify all the three words from the div and class attribute value is dynamic, so class attribute value number keep changes
Note: after “No” there is space and before “found” there is a space.
I’ve tried with below xpath:
//div[contains(@class,'o-text')]/self::div[contains(text(),'No')]/self::div[contains(text(),'messages')]/self::div[contains(text(),'found')]
But, unable to find the results.
Could anybody help me with xpath for identify all the words within the same div
This XPath,
//div[starts-with(@class,'o-text')]
will select all div
elements with a class
attribute value that starts with o-text
.
This XPath,
//div[normalize-space() = 'No messages found']
will select all div
elements whose space-normalized string-value is 'No messages found'
.
You can combine the two conditions via and
,
//div[starts-with(@class,'o-text') and normalize-space() = 'No messages found']
or via a compound predicate:
//div[starts-with(@class,'o-text')][normalize-space() = 'No messages found']