Script is not running successfully when there are multiple iterations

Ask general questions here.
upendra
Posts: 22
Joined: Tue Oct 06, 2015 11:27 am

Script is not running successfully when there are multiple iterations

Post by upendra » Tue Jan 14, 2020 11:20 am

Hi,
currently i recorded a script for an application and i want to run the script more than 1 iterations( e.g 5 iterations).
So i added the test data in the excel file and run the script after data binding.
I have added waitForExist statement or Delay statement as script was running very fast and sometimes Mouse was jumping out of the recorded screen/element.
I observed while first iteration is running and it waits for one element to exist and perform the operation, then in background , the 2nd iterations is running and when the wait or delay statement completed , the third iteration is starting instead of 2nd iteration.

e.g. While running , it waits for OK button( line 17 and 18 in the script) to click , in the background( means backside of OK button) it is clicking reset button( line 20 in the script) causing the failure of script or skipped the iteration.

Please find solution as an attachment.
Attachments
TPE.zip
(120.23 KiB) Downloaded 8 times

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

Re: Script is not running successfully when there are multiple iterations

Post by odklizec » Tue Jan 14, 2020 11:58 am

Hi,

At first, the zip you posted does not contain entire solution and there are missing files. For example, there are no xls files you are using as data connectors. It seems they are located on a network/shared drive? This is definitely a bad idea! All test and data files should be on a local HDD! Loading data from network drive could cause problems, but definitely not like the problems you've described.

Please post entire solution (including xls files), using menu Tools >> Compress solution.
Additionally, please a report file (ideally, zipped rxzlog), where we can see the error you are getting (and all steps leading to the error).
And finally, please post also a Ranorex snapshot (NOT screenshot) of the page in question, ideally, in state when the OK button appears. Thanks.
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

upendra
Posts: 22
Joined: Tue Oct 06, 2015 11:27 am

Re: Script is not running successfully when there are multiple iterations

Post by upendra » Mon Jan 20, 2020 7:50 am

Hi,
Sorry for the late reply.
I have attached the compressed solution along with snapshot and excel file used in the test.
Though the report i attached is displaying as passed , but it did not completed all the iterations , after 1st iteration it started 3 iteration.
The excel file is in local drive not shared drive.
Attachments
TPE.zip
(1017.96 KiB) Downloaded 7 times
Snapshot of the page where Ok button appears.rxsnp
(215.41 KiB) Downloaded 8 times

upendra
Posts: 22
Joined: Tue Oct 06, 2015 11:27 am

Re: Script is not running successfully when there are multiple iterations

Post by upendra » Mon Jan 20, 2020 7:54 am

Sorry, missed the report in earlier post.
Attached herewith

Regards
Upendra
Attachments
Report.zip
(207.73 KiB) Downloaded 8 times

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

Re: Script is not running successfully when there are multiple iterations

Post by odklizec » Mon Jan 20, 2020 8:31 am

Hi,

Thanks for the files.

At first, I don't see any error in report file you posted? Could you please post a report with error?
At next, the snapshot you posted, shows message with OK button, with this xpath:

Code: Select all

//input[#'ticket_price_form:success_OK_button']
However, the xpath of repo element you are looking for, with popupwatcher, looks like this...

Code: Select all

//input[#'ticket_price_form:continue_button']
So there is no way Ranorex would find the OK button. You must either create a new popupwatcher and corresponding repo element, or simply adapt the xpath of existing repo element, to point to both 'OK' and 'Continue' buttons. E.g. like this:

Code: Select all

//input[@id~'ticket_price_form:(continue_button|OK_button)']
Hope this helps?

BTW, the snapshot you posted complains about missing IE plugin. Even though the IE plugin is not really required for successful UI identification in IE, it would significantly speed up the search! So you should definitely install Ranorex plugin to IE.
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

upendra
Posts: 22
Joined: Tue Oct 06, 2015 11:27 am

Re: Script is not running successfully when there are multiple iterations

Post by upendra » Tue Jan 21, 2020 12:41 pm

Hi odklizec,
I did what you advised ( added pop up watcher for OK button along with continue button) but result was not as expected.
The status of the script is passed but it completed only 2 iterations out of 4. Every time script runs, it run for few iterations not all.
While it waits for Ok button to click for 1st iteration , it is displaying 2 iteration in ranorex run pop up window.
Please find the reports as an attachment.

Regards
Upendra
Attachments
Reports1.zip
(415.61 KiB) Downloaded 7 times

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

Re: Script is not running successfully when there are multiple iterations

Post by odklizec » Tue Jan 21, 2020 1:31 pm

Hi,

OK, we need to make one thing clear. The PopUpWatcher does not wait for the UI element and does not pause the test execution! It simply continuously search (in background) for given element and eventually clicks another defined element. And this is most probably also a cause of problems you are facing.

Basically, the PopUpWatcher runs in a separate thread and once an element is found it clicks it. However, there is no interaction with main (test) thread, which still continues with its steps. There is a method (PauseWhileExists) in PopUpWatcher class, which can pause the main test thread. The problem is that this method does not pause the main thread immediately, so there may still be performed some steps after the appearance of watched element.

In my opinion, your best option is to redesign your test and simply add some optional (not failing) actions at places, where the popup dialog can appear. Or add some kind of check (not PopUpWatcher-based), which detects the presence of popup window of your choice, ideally, at start (preferably Setup section) of the problematic test case or smart folder.
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