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. |
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 ...
|
|||||||
|
|||
|
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 |
| Sponsored Links |
|
|||
|
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 |
|
|||
|
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 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
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 |