Get Object Count

Let’s say you want to search for a product, such as a keyboard on an e-commerce site/app, and get count of the listed product in your test case.

You can do this using Opkey: Create a test case of the web page from where you need the specific object count of an item using the Opkey web recorder and save them. The image below adds the first four steps via the Opkey recorder:

Step 1. Open browser

Step 2.  Click username edit box

Step 3. Type text on the username and password edit box.

Step 4. Click on Sign in Button

As the last step, add the keyword ‘Get Object Count’ from the Opkey keyword library. This keyword gets the count of objects found with the given properties.

Provide the attribute details in the input parameter of the ‘GetObjectCount’ keyword such as Xpath or Class of the object. You can use up to five different properties to locate an object.

Now execute the test case to view the result:

Once done, the objects count on the web page will be retrieved and displayed.

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