This is a migrated thread and some comments may be shown as answers.

Searching a webpage for specific words

4 Answers 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
eugene
Top achievements
Rank 1
eugene asked on 30 Jul 2012, 04:42 PM
Hi,

Is there a way to check a website for specific words? For example, when I receive an 'Unexpected Error' on the page, I can still navigate through the toolbar and therefore, the test passes.

What I am looking to do is to fail the test if the words 'Unexpected Error' displays on the page.

Could anyone help with this?


Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 31 Jul 2012, 02:15 PM
Hello Eugene,

You can easily verify if the entire page contains or does not contain a certain string:
  1. Click the DOM Explorer button in the Recording Toolbar.
  2. Locate a top level element, like <html> or <body>, right click it, and select Show Element Menu (see screen shot 1).
  3. Click the Build Verification button from the Elements Menu (see screen shot 2).
  4. Click the Content button and verify that InnerText NotContain Unexpected Error.
  5. Click OK to save the verification to the test.

All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
eugene
Top achievements
Rank 1
answered on 31 Jul 2012, 02:57 PM
Thank you Anthony. That's exactly what I was looking for. I was on the right track, but I was trying to use (if...else) instead of just a verify.

I have another question regarding this topic. Is there a way that I can add this verify to the entire test so that it verifies for every step?


Thanks
0
Anthony
Telerik team
answered on 31 Jul 2012, 05:22 PM
Hello Eugene,

No, there's no way to do that (short of copying and pasting it after every step).

You may be able to incorporate that Verification into a While Loop, however, to achieve your goal. That way the verification would be rechecked after each iteration of the steps within the loop, but not after every single step.

Regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
eugene
Top achievements
Rank 1
answered on 31 Jul 2012, 08:09 PM
I see. Well thank you for all your help Anthony. The verify step was a life saver. To run against an entire test would be a great added feature.
Tags
General Discussions
Asked by
eugene
Top achievements
Rank 1
Answers by
Anthony
Telerik team
eugene
Top achievements
Rank 1
Share this question
or