Web test: Checking for disclaimer
I have a web test for a site that keeps failing because of a disclaimer that needs to be accepted on the page.
- It is a policy statement that pops up on the bottom and the user must click "Accept" to close it
- The problem is, I have added that step to my test, but if the Acceptance has already been cached the disclaimer does not pop up in subsequent tests. So the test step fails since TestComplete cannot find the disclaimer on the page.
Is there a step I can add to check for the disclaimer, and if it is not there just bypass the accept step and move on?
Hi brownla!
You can accomplish this by using the 'If Object' operation in your tests to check for the existence of an object, then perform other operations depending on the condition.
For instance, in the screenshot provided, I am checking for the existence of a banner on our Community page, if it exists then we click to remove it, if not then move on.
An important note here is that you will need to 'Else' operation as well to handle the logic.
Checking Whether an Object Exists
https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.htmlElse Operation
https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/statements/else.htmlI hope this helps!