Selenium Assignment – 9 – Email count in Gmail

In this next assignment, we will be practicing writing dynamic xpath and table handling.


  1. Open a browser of your choice say Mozilla Firefox using Gecko Driver
  2. Navigate to Gmail (
  3. Login to your Gmail with correct credentials.
  4. Verify that by default “Primary” section is selected.
  5. If not click on the Primary tab.
  6. Get the count of the total number of emails in the Primary tab.
  7. Get the name of the sender and subject of Nth Email of your inbox.
  8. Write a method to get the name of the sender and subject of email of your inbox.

Please refer below screenshot for the same.


Try this scenario and send us the code for feedback and assessment, or if you have any questions, queries or comments. Feel free to write us We will be back soon with next assignment.

Till then, Keep Learning 🙂

Saurabh Dhingra

About the Author

Saurabh Dhingra

Follow Saurabh Dhingra: