Handling dynamic runtime objects using GetObjectText keyword- New UI


Objects are grouped as static, dynamic, or runtime based on their property behavior. Static objects maintain constant properties, while dynamic ones change due to time or external actions like clicks. Examples include web forms and product listings. 


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. Runtime objects are generated during execution and possess unique properties. For instance, the order ID of a purchased product on an e-commerce site is a runtime object. 


Opkey identifies and fetches object properties during test case creation to locate objects on the test page and perform actions during execution. However, test executions often fail due to changes in dynamic object properties or the emergence of new runtime objects. Let's see how we handle this using the given below scenario.


Imagine a scenario where we will create a product and the generated product number will be used to create an invoice in a test case. To handle such scenarios where these objects are unique or change every time as are generated at runtime, hence difficult to capture in a test case. For this, we will save the product number object generated in a test step in a variable and use the same input in the required test step of the test case. This will let you capture the newly generated object every time.


Let's see how.


Login to Opkey, create a test case to add a product in the demo CRM, and pass the product number to the invoice. In the given below screenshot, a test case is created for the same. 


 


Go to step 16 of the created test case where the generated dynamic product ID is fetched. We’ll add the keyword Get Object Text by clicking the ‘+’ button after this step.  


 

 

Now add the keyword GetObjectText where you need to map the Object of Step 16. By doing this it will fetch the random dynamic object. To do so click on the Set Data icon respective to Step 17.  


 

Click on the Edit Test Object arrow in the window. 


 

Map the object of the previous step to the Get Object Text keyword. 


 


The object gets mapped. 


 


Now create the variable to save the output of the step to be passed to another step. Here we have created and named the variable as product number output.


 


Now select step number 32 where we will map the output variable of the Get Object Text keyword (dynamically generated product ID). To do this, click on the Set Data icon. 


 


Click on the data icon to map the values. 


 


Click on the Advance Options. Map it with the output variable named Product number that we created for step number 17. 


 


The invoice generated will now use the product number generated every time during the run in this test case. 

 

 You're now at the end of the end of the article.

 

 

 

 

 

 

 

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 atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article