Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to count the columns which loads run-time on scrolling
#1
Solved: 11 Years, 3 Months, 2 Weeks ago

Hi Friends,

When you login to Yahoo mail, when hundreds of emails are there all doesn't load at once, user has to scroll little by little to view all the emails, in this case. how would you write the script to count total no. of emails in the Inbox.

Thanks,
Kamal Teja
Reply
#2
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi Kamal,

I tried counting the total number of mails in my yahoo mail inbox. Actually there is a WebTable consiting of 25 mail by default per page.You can retrieve the "rows" property of the WebTable and can see 26 if on that page the number of mails is full. So the number of mails is one less that the row size (26-1).

Now for the first time when you enter your inbox, you retrieve the "rows" property of the WebTable and store it in a variable say mailCounter. Then loop with a condition which checks if "Next" link exists (if there are more than one page of mails i.e. mor than 25 mails exists, the Next link exists, otherewise it doesn't)then click through the Next link and again count the number of mails on that page and add it to mailCounter and so on.

So now lets take a scenario where there are say 58 mails. So the total number of page here will be 3 (25+25+8). So at first when u land on inbox page you retrieve the "rows" property i.e. having value 26. Deduct 1 from it and store it in mailCounter(25). Then loop.So for the first time the condition satisfied because "Next" link exists. It'll click through the "Next" link and land on the 2nd page, retrieve the "rows" (26), deduct one from it and add it to mailCounter(50). Now it'll check for the condition.It again satisfies since there is a third page. So it'll click on the "Next" link and land on the 3rd page. Now it'll retrieve the "rows" property (9), deduct one from it and add it to mailCounter(58). Now it'll again check the condition which this time doesn't pass since "Next" link is no more available. It'll come out of loop. In this way you get the total number of mails i.e. 58 stored in mailCounter variable.

Hope it'll work.
Reply
#3
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi KamalTeja,
I just tried the way which you said and did not face any issue. so please try once

see my code
Code:
Browser("Inbox (133) - Yahoo! Mail").Page("Sign in to Yahoo! India").WebEdit("login").Set "xxxxxxxx"
Browser("Inbox (133) - Yahoo! Mail").Page("Sign in to Yahoo! India").WebEdit("passwd").Set "xxxxxx"
Browser("Inbox (133) - Yahoo! Mail").Page("Sign in to Yahoo! India").WebButton("Sign In").Click
Browser("Inbox (133) - Yahoo! Mail").Page("Inbox (133) - Yahoo! Mail").Sync
Browser("Inbox (133) - Yahoo! Mail").Page("Inbox (133) - Yahoo! Mail").Link("Inbox (133)").Click
Browser("Inbox (133) - Yahoo! Mail").Page("Inbox (133) - Yahoo! Mail").Sync
r=Browser("Inbox (133) - Yahoo! Mail").Page("Inbox (133) - Yahoo! Mail").WebTable("Inbox").GetROProperty("rows")
MsgBox r

Please let me know for further clarification.

Regards,
Venkat.Batchu
Reply
#4
Solved: 11 Years, 3 Months, 2 Weeks ago
Please remember

Code:
Browser("Inbox (133) - Yahoo! Mail").Page("Inbox (133) - Yahoo! Mail").Link("Inbox (133)").Click

In this Inbox(133) is not constatnt how do you handle this??
Reply
#5
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi,

Use regular expression for this.

Let me know if u required any example or help for this.

Regards,
Sankalp
Reply
#6
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi,

Try the belowcode

strLinkName="Inbox\([0-9]+\)"

Code:
Browser("title:=.*").Page("title:=.*").Link("name:="&strLinkName).Click

Regards,
Ankesh
Reply
#7
Solved: 11 Years, 3 Months, 2 Weeks ago
Yes this will work. Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Loading QRS files at Run time dvkbabu 2 10,007 03-24-2017, 09:04 PM
Last Post: UrmilaSaha
  Missing Resources, Information Pane, Debug Viewer, Run time Data Table not visible Aurodeepta 3 6,967 05-28-2015, 02:52 PM
Last Post: Aurodeepta
  Object Identification not working on Run Time Ajatshatru 2 3,253 05-06-2015, 07:27 PM
Last Post: Ajatshatru
  Error while adding Object to Object repository at run time SaranKumarV 3 8,633 02-02-2015, 01:40 AM
Last Post: dubeyvin
Rolleyes How can we run QTP on virtual machine at scheduled time through VB script. ritugoyal 13 22,562 11-23-2012, 11:03 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)