i remember i wrote this code a while ago, hope it helps
Count_Test
${alllinkscount}= get element count xpath://a
log to console ${alllinkscount}
# ${alllinkscount}= Evaluate ${alllinkscount} + 1
# log to console \r${alllinkscount}
@{linkItems} create list
FOR ${i} IN RANGE 1 ${alllinkscount}+1
${linktext}= get text xpath:(//a)[${i}]
log to console \r[${i}], ${linktext}
END
I tried your html snipped and the <strong> does not influence the Get Text .
What sometimes is an issue is a (no-break space) which is a different character than a normal space.
Often Web developers use these to ensure that the spaces does not lead to a line break.
Maybe you can post the error message you get?
Ps: Three “Back Ticks” ``` before and after the preformatted code does the trick here in the forum.
Now maybe as a last resort:
you can log the “non printable” characters like this:
${text} = Get Text id=result
${escaped} = Evaluate [c if c in string.printable else r'\x{0:02x}'.format(ord(c)) for c in $text] modules=string
Log To Console ${escaped}
That weird python expression escapes non printable characters.
then you can figure out what there is.
Well you learn something everyday. Our internationalization library is putting these Unicode characters in by default to support display of bi-directional text. The HTML fragment I am testing is generated through that library (in our case to make sure pluralization of the word “result” matches the number of results) so it is putting in these Unicode characters. Turns out this is great as we will be working in right to left languages in the future.