Problem with "No-Break Space"

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
TroubleMaker
Posts: 6
Joined: Thu Feb 20, 2020 10:42 am

Problem with "No-Break Space"

Post by TroubleMaker » Thu Feb 20, 2020 10:54 am

Hi Guys,

My Problem is that I have two websites, with "the same" buttons on it. The only difference is that for one button, the innertext has a normal space and the other one has a no-break space ( ). Unfortunately, the RxPaths of both elements look exactly the same, but it doesn't identify one with another.
Is there a way to create one RxPath for both elements?
I attached two sample HTML-files which should demonstrate the problem.

Thanks a lot.
TroubleMaker
Attachments
Html examples.rar
(357 Bytes) Downloaded 9 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6036
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Problem with "No-Break Space"

Post by odklizec » Fri Feb 21, 2020 8:31 am

Hi,

I think the easiest way would be to construct the xpath, with just part of the text? e.g.

Code: Select all

 //h1[@innertext~'Heading']
This should return both instances of element.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

TroubleMaker
Posts: 6
Joined: Thu Feb 20, 2020 10:42 am

Re: Problem with "No-Break Space"

Post by TroubleMaker » Mon Feb 24, 2020 10:21 am

Hi Odklizec,

Thanks for your response.

That's true, but it seems that Ranorex doesn't show the difference between a no-break space and a "normal" space.
I'm currently using Regex to differ between the two characters.
/dom[@caption='Page Title']/?/?/h1[@innertext~'This is a( | )Heading']

I simply pasted the no-break space to the spy and it works well.
Maybe this will help someone in the future.

Cheers,
Trouble