Display results as :
Advanced Search

Go down
Regular Participant
Regular Participant
Posts : 27
Join date : 2010-10-04

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

on Wed Oct 13, 2010 2:28 pm

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
Posts : 387
Join date : 2009-07-30
Location : India

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

on Fri Nov 26, 2010 11:17 pm

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


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