Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Searching a string in a page

This is a discussion on Searching a string in a page within the QTP forums, part of the Software Testing category; This is my pseudo code- In QTP - I am searching a string in a page (comparing with my defined array). The string may be anywhere of the page. Can ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 10-08-2007
Expert Member
 
Join Date: Feb 2007
Posts: 1,279
Thanks: 0
Thanked 192 Times in 154 Posts
Geek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura about
Searching a string in a page

This is my pseudo code-

In QTP - I am searching a string in a page (comparing with my defined array). The string may be anywhere of the page.

Can anyone please give the code.

Thanks

Sudip Ray

Question asked by visitor Sudip Ray
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-23-2009
Expert Member
 
Join Date: Apr 2008
Location: Tamilnadu
Posts: 1,464
Thanks: 15
Thanked 150 Times in 141 Posts
deepasree has a spectacular aura aboutdeepasree has a spectacular aura about
Re: Searching a string in a page

Hai friend, here is the sample code, please change as per your requirement for p = 1 to .paragraphs.count
startrange = .paragraphs(p).range.start
endrange = .paragraphs(p).range.end
set trange = .range(startrange, endrange)
‘ tstring = trange.text
trange.find.text = searchstring
trange.find.execute if trange.find.found then
msgbox “yes! ” & searchstring & ” is present”
end if
next thanks
deepa
Reply With Quote
  #3 (permalink)  
Old 05-27-2009
Junior Member
 
Join Date: Apr 2009
Location: Bangalore
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
mani_vn is on a distinguished road
Re: Searching a string in a page

Hi

QTP has a method "GetVisibleText" to get the text from the specified area.

ex: abc = Browser("bname").Page("pname").GetVisibleText

now check the "abc" value with the string which you are searching using the INSTR....

for example,

SearchString = "Search"

abc = Browser("bname").Page("pname").GetVisibleText

If Instr(abc,SearchString) then
Msgbox " String Found"
else
Msgbox "String not Found"
End if

Try with the above code with proper application data...

MANI
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Difference between String.Convert Vs String.ToString jbanx C# 6 03-24-2008 01:02 PM
Full Text Searching vcyogi SQL Server 2 06-08-2007 09:41 AM
Winrunner is taking the entire web page as a single page Sridevi.P WinRunner 0 06-05-2007 11:26 PM
Searching for jobs anubroto Get Together 2 01-13-2007 11:22 PM


All times are GMT -4. The time now is 10:04 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved