Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to get the count of repeated word from the bodytext?

View previous topic View next topic Go down

How to get the count of repeated word from the bodytext?

Post by Priyanka on Wed Oct 13, 2010 2:28 pm

Hi,

I used selenium.getBodyText();

An example is given below
Mr ggg ggg DM Petrol QATEST 12:45:52
Mr lom sd QATEST 12:43:38
Mrs oui uio Enquiry about ... DM Diesel QATEST 12:36:34

The word QATEST is repeated in the bodytext. How can I get the count of that word from the bodytext?

FYI: Am writing selenium script using C#.
Please help..Tnx in advance

Priyanka
Regular Participant
Regular Participant

Posts : 27
Join date : 2010-10-04

Back to top Go down

Re: How to get the count of repeated word from the bodytext?

Post by Adviser on Fri Nov 26, 2010 11:17 pm

Hi,

Yes you can do it very easily. Follow the steps:

1. get the page source code into a string variable.
2. now use the inbuilt function of strings which found the occurrence of particular string into that string
ex: Console.WriteLine(TextTool.CountStringOccurrences(s1, "Sam"));
3. now you have number of count.

wohooooo...............this is what you want. Hope this will help

Best of luck

Bye


Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum