Quality Testing

Quality is delighting customers

How to validate the mandatory fields without filled or not using selenium web driver ?

Hi, I am new in selenium. i want to test mandatory fields without filled or not. i am working payroll domain in software company. now i am creating "New employee creation form" in hire page. In this form, there are several mandatory fields. Form will not be saved when any mandatory field is empty and it will show a validation message like : "Role company is mandatory". How can I check/automate the form? can any one please help me and give me code with example.

Views: 170

Reply to This

Replies to This Discussion

Generally, there are two ways used in web development companies(Developer used):

  1. when you enter or submit the form all the validations(required fields) are shown at once so that the user can identify all the required fields(tester can check all the text at once).
  2. when you enter or submit the form, the first required field gets highlighted with a validation message and after filling the value to that and submitting again then validation moves to the second required field and so on.

So at first identify which approach is used in your form so you can plan or write code according to that.

In qa testing services, When I checked with some renowned website's 'sign-in' page, they used the second approach that I mentioned above and in that case, 'className' in the source code for required field is same so every time using this(className) you can get text and check which one is empty or wrong.

Thank you so much for your reply Mr. Anand Singh.

Sure, i will plan to write the code as per you mentioned above 2nd approach. 

Once again Thanks for your guidance.


Geetha R

Hi, I am new in Selenium.. Now only started to learn.

can any one help me, how to get date column from excel sheet in selenium web driver using Apache POI library.

I tried date column in "Date" format also in excel sheet. but not able fetch the date input from excel sheet.

Please share me the script for the above query.

Geetha R


TTWT Magazine





© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service