Gmail Automation:
Clicking on Inbox Link without Using Regular Expression: (Using Object Repository)
1. Launch IE Browser as URL www.gmail.com
2. Provide Valid Credentials to Gmail to login to application.
3. Open Object Repository (Ctrl +R) in QTP

4. Click on “Add Objects to Local”, Observe that Hand Icon is displayed. Show the Hand Icon on “Compose Mail” Link and apply “Left Mouse Click” (Please view below screen shot for quick reference for Compose Mail Page)

5. The moment when you apply left click you can see the Pop window as like below on QTP Window i.e.

6. If we observe the above pop window focus is placed on “Link: Inbox(5)”
7. We are not going to add “Link” object to Object Repostiry so select “Web Table :Compose Mail”

After selecting the required object on “Object Selection-Add to Repositry” window, Click on [OK] button.
8. Its observed that object is added to Object Repository i.e.

9. Now drag and drop the Compose Mail object on QTP.
10. Now you might have seen the code on QTP i.e.

11. Change the code using “Childitem” method

12. Now Open GMAIL Application. Click on “Sent Mail” link so that we will come know that it navigates to “Inbox” page after execution of this script i.e.

13. Open QTP and run the script which we created i.e.

14. Click on “RUN” or “F5” function Key, Observe that it navigated to Inbox Page.

15. Send a mail to your Email id so that Inbox count will be increased by 1.

16. Now Open GMAIL Application. Click on “Sent Mail” link so that we will come know that it navigates to “Inbox” page after execution of this script i.e.
17. Open QTP and run the script which we created i.e.

18. Click on “RUN” or “F5” function Key, Observe that it navigated to Inbox Page.
Clicking on Inbox Link without Using Regular Expression: (Using Descriptive Programming)
Browser("name:=Gmail.*").Page("title:=Gmail.*").WebTable("name:=Compose Mail.*","Index:=1").ChildItem(3,1,"Link",0).Click

Here I am passing Index: =1 because we have two similar objects i.e. WebTable name called “Compose Mail”.