Issue with data driven section of xpath

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
andy.simpson
Posts: 32
Joined: Fri Jun 22, 2018 8:59 am

Issue with data driven section of xpath

Post by andy.simpson » Fri Apr 05, 2019 11:58 am

Hi,

First off I'm using Ranorex 8.3

I have an issue where I wish to have part of my xpath data driven from an excel data connector, the xpath itself works fine until its substituted for variable. The variable of the path is the innertext of the web element (there is nothing else it can be)

Here is the full original xpath (ive left the domain out, its not the issue)
//frame[#'leftFrame']//form[#'formData']//td[@innertext='Workflow Process:']
and here is the xpath with the variable
//frame[#'leftFrame']//form[#'formData']/table//td[@innertext=$HeaderLabelName]
and heres the failure showing that the variable has been substituted correctly, but the item cannot be found
'R4ItemRepository.DocumationWorkflow.IndexingPanel.HeaderIndexScreen.HeaderIndexDataDrivenLabel'. Please check that your whitelist allows Ranorex to access the process.
No element found for path '/dom[@caption='Workflow']//frame[#'leftFrame']//form[#'formData']/table//td[@innertext='Workflow Process:']' within 1.5m.
I've used variables in xpaths before without hassle but in this instance it doesnt seem to work, ive attached a snapshot, any help would be appreciated
Attachments
workflowprocess.rxsnp
(188.95 KiB) Downloaded 9 times

andy.simpson
Posts: 32
Joined: Fri Jun 22, 2018 8:59 am

Re: Issue with data driven section of xpath

Post by andy.simpson » Fri Apr 05, 2019 12:15 pm

Here are two repo items for the object in question, the first one has innertext which has been typed on straight into Ranorex(and finds the object successfully, the other has innertext which has been copied over from excel data connector and does not find the object

Could it be something to do with the text format being passed through from excel?
Attachments
xpath example.PNG
xpath example.PNG (9.16 KiB) Viewed 262 times

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

Re: Issue with data driven section of xpath

Post by odklizec » Mon Apr 08, 2019 9:03 am

Hi Andy,

There is a problem with space character, between 'Workflow' and 'Process' words. The 'space' char, stored in the snapshot (and therefore used in your GUI) is so called non-breaking space (see https://en.wikipedia.org/wiki/Non-breaking_space). A standard 'space' char uses HEX code 20, while the one used in your app uses A0:
InvalidSpaceCharacter.png
InvalidSpaceCharacter.png (26.7 KiB) Viewed 236 times
Therefore, the one you stored in your Excel data source is most probably wrong ;) I believe that if you copy exact string from Spy/Snapshot and paste it in Excel, the space should preserve its format. Just don't enter the text manually, especially space characters ;)
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

andy.simpson
Posts: 32
Joined: Fri Jun 22, 2018 8:59 am

Re: Issue with data driven section of xpath

Post by andy.simpson » Mon Apr 08, 2019 9:53 am

Perfect thanks :)