TestProject Forum
Powered by leading experts in the test automation community

Getting search result count

How do I get the search result count e.g. from Google search (About 6 500 000 000 results (0,48 seconds) I want to get count of result which is 6500000000 and if its more than 1 then Pass the test case.

How will I do it? Is there any add on available or do I need to create my own add on?

Please suggest

Since you can get that value from a div in the page, you can get the text from it, and perform string operations on it to either edit the string, or perform validations on it.
You can use the regex actions for example to cut out all the non-numeric digits in the string, and and then remove the last 3 numbers involving the search seconds.
After that you can perform a validation to check if the value is greater than something or not.

Hello, Thanks for the reply. I looked for TestProject UI to do the same but could not do it (I am new to TestProject). I can do it with Java code easily but wanted to use TestProject features. Can you please point me to documentation for the same?

Hey, there are several ways to achieve that in TestProject , here one of them

  1. locate the element

  1. use get text action to extract the text and create new parameter to pass the string

  1. add Get substring action BeginIndex will be 6 and and EndIndex will 7 (since you are looking for the fist number of the search results)

  2. on that step add a validation on the parameter , greater>1

  1. and here you go

Thanks for the reply. I will explore more in this area. Thanks again!