Synchronization

Synchronization in UFT is a generic way to have specified amount of time for  an object to process prior to moving to next step. “ReadyState” is one of the best possible way to synchronize, generally used to wait till the full loading of DOM tree and used as   like

Browser().Object.readyState

 

Ready State Property

Every XML and HTML document in any HTML/web application is called as Document. Every time the document gets loaded/removed based on the navigation/action is performed  by the user. Each document has a current document readiness which is set depending on the current document readiness  status. The same applies for the objects in the document as well.

‘readystate’ property of the document retrieves the value, that indicates the current state of the document readiness.

object.readystate

when you set a url to load a particular page, the value will be set as ‘loading’ if the page is associated with a parser like HTML or XML parser. Once the parsing is done and page is loaded, the value will be set as ‘complete’.

The possible values of readystate are-

uninitialized‘ if the Object is not initialized with data.
loading‘ when object is loading its data.
loaded‘ if the object has finished loading its data.
interactive‘ if the User can interact with the object even though it is not fully loaded.

complete‘ when the object is completely initialized.

An object’s state is initially set to uninitialized, and then to loading. When data loading is complete, the state of the link object passes through the loaded and interactive states to reach the complete state.

This property can be used to synchronize the test steps better, which involves loading/navigation of pages. This will give you the exact sync between the two steps. for example if you want to wait till the page loads completely.

Do while ((Browser().Page().Object.ReadyState<>"complete"
wait(1)
Loop

 

See also  UFT 14.50 All-New Features

13 COMMENTS

  1. Stumbled into this website by chance but I’m sure glad I clicked on that link. You positively answered all the questions I have been dying to answer for some time now. Will definitely come back for more of this. Thank you so much

  2. Simply want to say your article is as surprising. The clarity on your put up is just spectacular and i could think you’re an expert on this subject.

  3. Hi Saket,

    This is my Script for password but its through general error.
    Browser(“micclass:=Browser”).Page(“micclass:=Page”).Link(“Index:=3”).set “India”

    if i use this code its executing, why Micclass:=Browser is not supporting on my application.

    Browser(“name:=Home).Page(“title:=Home”).Link(“Index:=3”).set “India”

    • Do you have multiple browsers open at the time you are executing? It might be because of that. micclass=Browser represents any open browser and if multiple browser are open. it wont work. Always use creation time property for Browser, which is most reliable.

  4. Hi saket,

    I am trying to prepare script using Mozilla v10 and UFT 11.5 but my tool is not identifying the object. As per forum UFT 11.5 supports Mozilla v10 & v11, but in my case its not supporting.

    Please give your valuable suggestion/feedback & kindly assist

  5. hi Saket
    in the above example could you please explain( <&gt ) what are these two in the object description

    thanks for the post ,

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.