Scenario
In the different concepts of this section, we have worked on interacting with many types of web elements that belong to a form. In this activity, we'll make use of the different concepts to create an automation script that interacts with the different types of elements on a web page.
Aim
To create a full automation script that interacts with different types of elements on a web page.
Steps for Completion
- Review and analyze the structure and behavior of the https://trainingbypackt.github.io/Beginning-Selenium/lesson_3/exercise_3_1.html file.
- Create a new Java file for the automation script. Make sure that you include the required libraries.
- Locate the textbox of id "firstName", and input some text. In this case, input "John".
- Locate the textbox of id "lastName", and input some text ("Doe").
- Locate the dropdown list of id "dayOfBirth"; select the option "20".
- Locate the dropdown list of id "monthOfBirth"; select the option "March" by sending its value.
- Locate the dropdown list of id "yearOfBirth"; select the option "1990" by sending its value.
- Locate the dropdown list of id "hobbies"; select these two options: Reading and Sports.
- Locate the radio button "Masters"; select a radio button by clicking on it after it has been selected.
- Locate the checkbox "emailUpdates". and enable the "I want to receive email updates" field.
- Locate the textarea of id "aboutYourself", and input some text.
- Include an instruction to click on the Submit button.
- Compile and run the script.
To refer to the detailed steps, go to the Solutions section at the end of this book on Page no. 165.