How to search and replace an xPath in multiple solutions?

Best practices, code snippets for common functionality, examples, and guidelines.
mariya.syera
Posts: 9
Joined: Wed Nov 08, 2017 10:59 pm

How to search and replace an xPath in multiple solutions?

Post by mariya.syera » Wed Nov 08, 2017 11:41 pm

Windows 10, 64-bit operating system
Ranorex version 7.0.1

Trying to replace an xPath in few solutions using the main folder that they are all located in.

Note: when I search for that xPath in the current solution while having it open it finds it in the user code with no issues.

Any suggestions on how I can make it work? (I tried using different options provided in this tool still can't find it)
Attachments
SearchAndReplace.jpg
SearchAndReplace.jpg (67.94 KiB) Viewed 547 times
Mariya Syera
Office Ally, Inc

qwertzu
Posts: 178
Joined: Wed Jan 25, 2017 11:08 am

Re: How to search and replace an xPath in multiple solutions?

Post by qwertzu » Thu Nov 09, 2017 1:34 pm

hi,
Have you tried to use the "Match Case" option?
However, I´m not sure if its a good idea changing the paths by using this replace function. I´d rather suggest changing the paths by editing the elements in the repository.
regards, qwertzu

mariya.syera
Posts: 9
Joined: Wed Nov 08, 2017 10:59 pm

Re: How to search and replace an xPath in multiple solutions?

Post by mariya.syera » Fri Nov 17, 2017 6:40 pm

Hi,
I have tried using Match Case option still doesn't work.
Also I realized that Search and Replace only searches in the user code and not the repository. When it replaces it also only replaces in the user code and no changes done on the repository xPath.

Any ideas why it doesn't find it in the Repository Path?
Attachments
SearchAndReplace2.jpg
SearchAndReplace2.jpg (119.57 KiB) Viewed 514 times

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

Re: How to search and replace an xPath in multiple solutions?

Post by odklizec » Mon Nov 20, 2017 2:30 pm

Hi,

The problem is, that the repository xpath is stored in rxrep (xml) file, from which is auto-generated a corresponding cs file. And I guess the rxrep file is most probably not included in search&replace tool. I would suggest to use an external file editor (like notepad++) to search/replace all solution files. But before you do that, make sure the working version is stored in source control system, so you can always return back the last working state ;)
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

mariya.syera
Posts: 9
Joined: Wed Nov 08, 2017 10:59 pm

Re: How to search and replace an xPath in multiple solutions?

Post by mariya.syera » Tue Dec 12, 2017 6:19 pm

Where would I see the XML file? The only XML file I see is the XML Configuration which does not store my repositories.
Attachments
AllFiles.jpg
AllFiles.jpg (138.18 KiB) Viewed 463 times
Mariya Syera
Office Ally, Inc

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to search and replace an xPath in multiple solutions?

Post by krstcs » Tue Dec 12, 2017 6:52 pm

Technically, every file that has an ".rx..." extension is XML. RXTST, RXREP, RXREC, etc. XML is the format of the text data inside the files. Ranorex just uses specific ".rx*" naming for the XML files they use to define the actions, repo, and suites. In .NET terms these XML files are paired with code files (*.CS and *.USERCODE.CS), all named the same, except the extensions, that together define that particular part of the overall Ranorex framework.

In this case, the most likely files that should be looked at are the *.rxrep and similarly named *.cs files.



I would also highly recommend that you open Windows Explorer and under the "View" tab, uncheck the "Hide extensions" checkbox as this will allow you to see the actual file types more easily. Microsoft decided a while back to default this setting to be ON, which can cause issues with security, not to mention that it makes identifying files a little more difficult.
Shortcuts usually aren't...