Micro Focus QTP (UFT) Forums
need vbscript to search for a "text string" on a google search page ? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: need vbscript to search for a "text string" on a google search page ? (/Thread-need-vbscript-to-search-for-a-text-string-on-a-google-search-page)



need vbscript to search for a "text string" on a google search page ? - vimal singh - 07-15-2010

for eg. On google search page, I enter text "advanced qtp" and click on google search button. It shows no. of pages with result. I want to search for a specific text "Advanced Qtp - Students Hang Out". But I dont know on which page the expected text is lying. My script shd look for the expected text "Advanced Qtp - Students Hang Out" on each page one by one and if it finds the expected result then it shd show a message PASS and the page no. can anyone send me the script ?


RE: need vbscript to search for a "text string" on a google search page ? - Saket - 07-16-2010

you should ask for a praticular issue you face to resolve your tasks rather asking for complete script. if you try yourself, you will learn more.

what we can help you now is with guidelines if you need -
1. after submitting your text at google page get all the links from page you can use 'Description.Create' method.
2. get the current page initialized as 1.
3. loop through all the links you get and look for the text in each link, you can use 'instr' if found return the link and current page
3. click the next page link and do the same again

let us know if you face any issue in implementing this.