How to change the path for all items at a single time when network line is changed?

Ask general questions here.
samsung_rx
Posts: 1
Joined: Tue Jul 13, 2021 8:31 am

How to change the path for all items at a single time when network line is changed?

Post by samsung_rx » Tue Jul 13, 2021 9:14 am

Currently I am using vodafone line(external) network which uses Ip address 10.10.x.x. I want to run the scrips on airtel line(internal network) with ip config 107.109.47.x. The syntax of many items have IP address. How can I change the syntax at a single go? I want to run the code on all networks. Please suggest some solution.
Eg: .//div[#'root']/div/div/div[1]/div[1]/form[@action='http://10.10.10.228:7001/MagicInfo/login']/div
I want to change the IP address to 107.109.226.85. There are multiple items which have similar syntax

dhale
Posts: 84
Joined: Thu Feb 27, 2014 7:33 pm

Re: How to change the path for all items at a single time when network line is changed?

Post by dhale » Tue Jul 13, 2021 6:37 pm

To keep it simple you have two choices:
#1.) You can either pass in the IP address as a variable if its important and needs to be tested... (I wouldn't do it like this myself...)
or
#2.) You can remove the ip address from the url that you have specified in your path. (this is what I would do...)
eg:

Code: Select all

 .//div[#'root']/div/div/div[1]/div[1]/form[@action='http://10.10.10.228:7001/MagicInfo/login']/div
becomes

Code: Select all

 .//div[#'root']/div/div/div[1]/div[1]/form[@action~'MagicInfo/login']/div
And on a side note - your rxpath is likely too specific and could probably be more a bit more robust if it were even less specific:

Code: Select all

 .//div[#'root']//form[@action~'MagicInfo/login']/div

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

Re: How to change the path for all items at a single time when network line is changed?

Post by odklizec » Wed Jul 14, 2021 9:28 am

Hi,

I agree with dhale's comments. But if you insist on using the ip address (from whatever reason), the easiest way to replace a string on multiple places in repository, is to directly edit rxrep file in a good text editor (notepad++ or similar). Of course, make sure you have a backup copy of last working state in source control of your choice ;)
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