How to access and submit a form in selenium WebDriver?
This blog will help you understand how you can access forms in Selenium to automate browser testing of your web application
Selenium supports multiple languages but here focusing on selenium with java. So for that you need to have java in your machine before you start writing an automation scripts.
In the following, we are going to see the easiest way to create a java program to access a simple contact us form of an Application Under Test (AUT). We can create a simple data set in excel for contact us form which can be used to automatically enter and submit data.
The following are prerequisites to accomplish the above
Creating an automation test includes the following steps
- Create a Maven Project
- Create a Java class for Contact us form
- Create a data set
- Write functional logic
- Run test script
Now it's time to create a contact us form project for the sample Selenium project in Eclipse . This will be a maven project, which you can create by following the steps given below.
1. Create a Maven Project
- i. Open your eclipse and go to File > New > Other, select Maven Project and click Next.
- ii. Select the ‘maven-aechetype-quickstart‘ and click Next.
2. Create a Java class for Contact us form
3. Create a data set
The complete source code is available in github. The code can be imported in Eclipse from File > Open Projects from File System.
4. Write functional logic
5. Run test script
Continue Learning!