How to deal with XPATHs which always contain a hardcoded value #302
Replies: 5 comments
-
Hi Marcin, Please see the attached image. When you open the automation step you can edit the XPtah value: In the Ptah text-box you can use custom variable - in this case {CustomTab} variable is a local variable. [gui_image.png]
Aharon Shachar (Aharon.S) - 06/19/2016 01:39 AM
|
Beta Was this translation helpful? Give feedback.
-
Hi Aharon, This is not what I asked about. I knew how to introduce a variable. My question was whether there is a way to avoid a variable.
Thanks, Marcin (Quali) - 06/19/2016 03:29 AM
|
Beta Was this translation helpful? Give feedback.
-
Marcin, You can use the Ranorex repository - the repository will have the 'Base URL' & each step will have the page suffix. Thefull pathwould be combination of theRepositoryand theRelative Path. In order to create repository use 'Raorex Recorder' (not the spy) and import your record (include the repository).
path.png [74.5 kB] Aharon Shachar (Aharon.S) - 06/20/2016 06:00 AM |
Beta Was this translation helpful? Give feedback.
-
Can you please confirm if my understanding is correct: Following your suggestion from your last post, way we end up hard-coding the repository with the 'Base URL' and the same test won't run in another instance of the environment. I wanted to avoid hard-coding and using a variable in the first place, please see the last paragraph in my original question. undefined (Quali) - 06/20/2016 08:12 AM |
Beta Was this translation helpful? Give feedback.
-
Marcin Working with local GUI repository should solve your problem. Aharon Aharon Shachar (Aharon.S) - 07/14/2016 08:11 AM |
Beta Was this translation helpful? Give feedback.
-
I'm automating a Web GUI portal (accessible from the Internet Browser) and XPATHs tracked by Ranorex Spy for each and every element contain the same hardcoded value of the IP address and the port number.
Examples of some XPATHs:
/dom[@Domain='10.65.111.102:8080']//textarea[#'arid600000012']
/dom[@Domain='10.65.111.102:8080']//div[#'FormContainer']//div[@innerText='View Work Order']
/dom[@Domain='10.65.111.159:8080']//input[#'_ResidentialEndUserConnectionPortletWindow:_viewRoot:j_id1:applicationReference']
What would be your advice to avoid this hardcoded value in all XPATHs? I could introduce a variable, but it is not a desired solution because I'd need to include this variable in every GUI function I develop. So the best way would be to avoid the hardcoded bit.
I will appreciate your advice.
(Quali) - 05/24/2016 11:13 AM
· 2617 ·
Beta Was this translation helpful? Give feedback.
All reactions