TestComplete Tips: Checking if Web Page Contains Specific Text

  December 08, 2006

When testing web pages you often need to check if a web page contains
specific text before continuing with the next step. You can perform
this check by using TestComplete’s functionality.

To check if the web page contains specific text, you can obtain the page’s source code and search for the desired text in it. The following code demonstrates how you can do this in TestComplete. The sample routine works with the web page that displays the orders list. To view this page, open the <TestComplete>SamplesOpen AppsOrdersDemoWebStart.htm page in your Internet browser and click View all orders. The test script works with Internet Explorer 6. If you use another browser, you will need to modify the script lines responsible for obtaining the Page object and the document object.