Wait until all pages load in ranorex

Ranorex Studio, Spy, Recorder, and Driver.
praneet
Posts: 38
Joined: Thu Nov 08, 2018 2:22 am

Wait until all pages load in ranorex

Post by praneet » Wed Jul 17, 2019 11:02 am

How to wait until all opened tabs/pages are loaded in browser without verifying title or ranorex repository element.
Please provide me the usercode

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

Re: Wait until all pages load in ranorex

Post by odklizec » Wed Jul 17, 2019 11:19 am

Hi,

Unfortunately, there is too little info about your problem. Generally speaking, you can use
WaitForDocumentLoaded (InvokeAction) method, which waits for web page to complete its loading. You have to define DOM repo element for this action. Additionally, you can add [@state='complete'] attribute at the end of DOM element in repo, which should pause the execution of test until the DOM element is completely loaded.

I don't quite understand your need to wait for loading of multiple web pages/tabs, because Ranorex can work with just one actually active/loaded web page? Could you please describe your problem in more details?
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

manish
Certified Professional
Certified Professional
Posts: 53
Joined: Fri Aug 10, 2018 12:46 pm

Re: Wait until all pages load in ranorex

Post by manish » Thu Jul 18, 2019 11:46 am

Hi Praneet,

You can create a repository element with Rxpath "/dom". This would in essence be a refrence to all the dom elements (open web pages in all open browsers). Next you can use the code below to check if a webpage has finished loading comlpletely for a specific browser

Code: Select all



		var domList =  repo.dom.SelfInfo.CreateAdapters<Unknown>();
			foreach(var dom in domList){
				if(dom.GetAttributeValue<string>("browsername").Equals("Chrome")){
					while(!dom.GetAttributeValue<string>("state").Equals("complete")){
						Delay.Duration(1000);
					}
				}
			}
			
This code would wait, in sequence, for all webpages opened in Chrome browser to be loaded completely.


BR
Manish