Do I need to record every time if the web page updated?

Ask general questions here.
Gowtham
Posts: 22
Joined: Fri Oct 26, 2018 1:42 pm

Do I need to record every time if the web page updated?

Post by Gowtham » Thu Jan 17, 2019 9:08 am

Hi,

I have a sample web page which has a registration form where I have 5 input fields. I have recorded a script. Then I have updated the web page(Say, I have included one text field in between) now the web page has 6 input fields. If I run the previously recorded script, the script runs till the new input field. It could not find the other input fields down the page. I checked the recording, it captures the coordinates of the input fields. I think it could not find as the input field coordinates have changed.

Do I need to record every time if the web page gets updated? If the web page gets updated the previous recordings will not run as the element coordinates changed?

Thanks & Regards,
Gowtham.
You do not have the required permissions to view the files attached to this post.

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

Re: Do I need to record every time if the web page updated?

Post by odklizec » Thu Jan 17, 2019 9:30 am

Hi,

If the xpath of each recorded element is unique and specific enough, there should be no need to re-record anything when the page changes. This is the beauty of Ranorex xpaths. Unfortunately, without seeing your Ranorex repository and snapshot of the page (NOT screenshot), it's impossible to tell how good your repository is. Could you please upload a snapshot of the page and ideally, also repository file (or at very least xpath of the problematic element, as stored in repository).

If there are new elements added to the page, you, of course, need to add them to repository and recording module, either by recording them or manually, by using Track button.
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

Gowtham
Posts: 22
Joined: Fri Oct 26, 2018 1:42 pm

Re: Do I need to record every time if the web page updated?

Post by Gowtham » Thu Jan 17, 2019 9:52 am

Hi odklizec,

Here is the x-paths,

I have added radio buttons on the web page. The Email field and Country Name are not recognized. What I want is, the script was recorded before adding radio buttons, now after adding the radio buttons if I run the old script it should ignore the radio buttons and run as before.

Kindly suggest how to edit xpaths so that I do not have to record every time if the web page gets updated.

Thanks & Regards,
Gowtham.
You do not have the required permissions to view the files attached to this post.

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

Re: Do I need to record every time if the web page updated?

Post by odklizec » Thu Jan 17, 2019 10:04 am

Hi,

I see. The problem is in the index part of the xpath ([1],[2],[3], etc...). Simply remove the index number after 'tr' tag and all should work as before. Because there are new rows in the table, email and country fields are no longer in rows 5 and 6, therefore Ranorex cannot find them. Generally speaking, you should avoid using indexes and use them only if there is absolutely no other way to identify some elements.
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

Gowtham
Posts: 22
Joined: Fri Oct 26, 2018 1:42 pm

Re: Do I need to record every time if the web page updated?

Post by Gowtham » Thu Jan 17, 2019 10:33 am

Hi odklizec,

Thank you so much for the solution.

It works fine!

However, one more quick question. I see now the element is identified by the element id. While recording, is there anyway to identify the elements only by element id? As we know in this case the table row id messed it up as it is changed. Is there any option to choose/edit the xpath while recording itself?

Thanks & Regards,
Gowtham.

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

Re: Do I need to record every time if the web page updated?

Post by odklizec » Thu Jan 17, 2019 10:52 am

I'm glad it helped ;) As for your next question, you can edit the xpath after recording, not during recording. And I'm afraid, there is no way to tell Ranorex to create the xpaths with just element id. But you can change the way the xpath is constructed using these settings:
XPtahSettings.png
RanorexXPath generation mode set to Reduce should make the xpath noticeable shorter.
Eventually, try StepCostReduce and modify settings in Edit path build options. I found that lower number (e.g. 10%) in Quantile Threshold makes the xpath significantly shorter, without unnecessary elements. Just give it a try ;)
You do not have the required permissions to view the files attached to this post.
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

Gowtham
Posts: 22
Joined: Fri Oct 26, 2018 1:42 pm

Re: Do I need to record every time if the web page updated?

Post by Gowtham » Fri Jan 18, 2019 5:10 am

Hi odklizec,

Thanks Again.

You are amazing. This is what I was looking for. Now the xpath is much more reduced and looks neat.

Thanks & Regards,
Gowtham.