Handling Dynamic Objects using ByText Keywords - New UI

In a test case, objects represent components of an application where actions are performed. Each object possesses distinct properties or attributes, such as name, XPath, CSS, tags, etc.


Objects are grouped as static, dynamic, or runtime based on their property behavior. Static objects maintain constant properties, while dynamic objects change due to a change in the underlying property like CSS, Xpath, etc.


Why do we need to handle Dynamic objects?


In the case of some applications where dynamic elements are very common it is recommended to maximize the use of ByText Keywords along in the test cases. But, why do we need to handle dynamic objects. 


During the test execution, there are multiple processes being performed in the background. There are multiple loads taken by the test application like page loads, angular load, xmlhttprequest load, Jquery load, etc. These processes may delay the actual visual appearance and backend properties of an object on the page. In such scenarios, test executions often fail due to objects not being found due to changes in appearance or properties. 


Additionally, there are scenarios when a single web page has multiple elements with some common properties which may result in the action getting performed on the wrong object leading to test execution failure. 


To avoid test execution failure in such scenarios, you can utilize "ByText" keywords. These keywords leverage the 'Visual Object Identification Technology' to visually recognize the object within an application. For example - fetch the ‘Sign out’ button using its textual name. 


This represents a cutting-edge approach that facilitates dynamic testing across various enterprise-level applications and platforms. It locates an element with the help of its text properties and other visual attributes and acts on it.


Understanding use of ByText keywords in Test Cases 


Consider a scenario where a tester wants to add a logout step in a test case. He is unable to capture the logout button using the Opkey recorder as it’s a dynamic object. So we capture this button object by its name using the "Web_ClickByText" keyword to add and execute the logout action in the application. Let’s see how:

 

Given below screenshot shows a test case for ‘Lead generation’ workflow on a web application:


 



Now, we want to add the sign-out step using a keyword to the test case. To add the keyword click on the Add Step button:





Now go to the last step and add the Web_ClickByText keyword. 



 



Select the Set Input Data icon to enter the details. 



 



Enter TextToSearch as Sign Out.


 


Save the test case. 



 

 

Click on the run button to execute the test case. View the execution results post-execution.


You have now learned how to use by text keywords. 


Read more such related articles by clicking here.


 

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article