Knowledge Base Article

Home Page > Knowledge Base > Rapise

Home Page > Knowledge Base > Rapise > Rapise Web

Article Using CheckObjectExists(xpathOrObjId) to See if Web Object Exists on Page

by Adam S on Thursday, January 7, 2016

This articles describes how you can use the Navigator.CheckObjectExists(...) function to see if a web page exists and how it differs from the Global.DoWaitFor / DoWaitForProperty functions that are described in another article.
Firstly, the Global.DoWaitFor(...) and Global.DoWaitForProperty(...) functions are both generic and can be used for all kinds of applications - web, desktop or mobile. The Navigator.CheckObjectsExists(...) function is part of the Navigator object and therefore can only be used for web application tests.

In addition, the CheckObjectExists function can use either an XPATH/CSS string or a Rapise learned object name, so it gives you the ability to check an arbitrary XPATH/CSS query without the object needing to be learned beforehand, which can sometimes be useful.

Here are some examples of both syntax options (XPATH vs. CSS):

1) Using an Object ID

You can use the same ObjectID that you would use an SeS(...) command:

Navigator.CheckObjectExists('Log_In')

2) Using explicit XPATH/CSS

You can use an explicit XPATH expression as well:

Navigator.CheckObjectExists('//table[@id="tblBooks"]//tr/td[0]')
Attachments
Article Info
Last Updated: 1/7/2016
Article ID: KB187
# Views: 371
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.