Demo Automation Practice Form
AUTOMATION PRACTICE FORM
First name:
Last name: Gender Male Years of Experience 1 2 3 4 5 6
Date:
Profession Manual Tester
Automation Tools UFT Protractor Selenium WebdriverContinentsSelenium Commands
First name:
Last name:
Gender Male
Years of Experience 1 2 3 4 5 6
Date:
Profession Manual Tester
Automation Tools UFT Protractor Selenium Webdriver
Continents
Selenium Commands
How to Automate 'Practice Form' with Selenium WebDriver
This is a demo web form that contains all the form elements which are mostly present on any web page. So, by automating this form you would learn all the WebDriver commands which are required to automate a web page. This web form contains the following web elements:
- Links
- Text boxes
- Radio buttons
- Date Picker
- Checkboxes
- Select box
- Multi Select box
- Upload Image button
- Download link
Steps to Automate:
- Open this link - https://www.techlistic.com/p/selenium-practice-form.html
- Enter first and last name (textbox).
- Select gender (radio button).
- Select years of experience (radio button).
- Enter date.
- Select Profession (Checkbox).
- Select Automation tools you are familiar with (multiple checkboxes).
- Select Continent (Select box).
- Select multiple commands from a multi-select box.
- If you can handle Upload image then try it or leave this step.
- Click on the Download File link and handle the download file pop-up (leave it if you are a beginner).
- Click on Submit button.
- Try your own logic and automate it without any help. If you still find it difficult to automate then follow reference links.
Example Code:
package com.techlistic.tute; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Alert; import org.openqa.selenium.Keys; import java.util.*; import java.net.MalformedURLException; import java.net.URL; public class PracticeFormTest { // Main Method is the execution point of any Java Program public static void main(String[] args){ // Initialize Webdriver Object System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); // Open URL driver.get("https://www.techlistic.com/p/selenium-practice-form.html"); // Set Chrome window size driver.manage().window().setSize(new Dimension(1552, 840)); // Enter Firstname driver.findElement(By.name("firstname")).click(); driver.findElement(By.name("firstname")).sendKeys("Tom"); // Set Lastname driver.findElement(By.name("lastname")).click(); driver.findElement(By.name("lastname")).sendKeys("Wood"); // Select Gender driver.findElement(By.id("sex-0")).click(); // Select Experience driver.findElement(By.id("exp-4")).click(); // Enter Date driver.findElement(By.id("datepicker")).click(); driver.findElement(By.id("datepicker")).sendKeys("16-10-2020"); // Select Profession driver.findElement(By.id("profession-1")).click(); // Select Automation Tool driver.findElement(By.id("tool-2")).click(); // Select Continent driver.findElement(By.id("continents")).click(); WebElement dropdown = driver.findElement(By.id("continents")); dropdown.findElement(By.xpath("//option[. = 'Europe']")).click(); // Select Command WebElement dropdown = driver.findElement(By.id("selenium_commands")); dropdown.findElement(By.xpath("//option[. = 'Browser Commands']")).click(); // Scroll Vertical js.executeScript("window.scrollTo(0,675.5555419921875)"); // Click Submit driver.findElement(By.id("submit")).click(); } }
Popular Tutorials:
You may also like to read:
- 50+ Selenium WebDriver Interview Questions
- Top 25 Selenium WebDriver Commands with Java
- What are Java Class and Object?
- What is an Actions Class in Selenium?
- What is Robot Class in Selenium?
- How to take partial screenshots with Selenium?
- Checklist and Best Guidelines to Test a Website
You may also like Selenium Practice Exercises with example code:- Automate Amazon like E-Commerce website with Selenium
- Automate GoDaddy website features with Selenium
- Automate Google search with Selenium
- How do Find all the broken links on a website with Selenium
- How to Handle Static and Dynamic Web Tables with Selenium
- Automate Handling Multiple Browser Tabs with Selenium
- Automate Upload and Download files with Selenium
You may also like Selenium Practice Exercises with example code:
- Automate Amazon like E-Commerce website with Selenium
- Automate GoDaddy website features with Selenium
- Automate Google search with Selenium
- How do Find all the broken links on a website with Selenium
- How to Handle Static and Dynamic Web Tables with Selenium
- Automate Handling Multiple Browser Tabs with Selenium
- Automate Upload and Download files with Selenium
Automate GoDaddy.com with Selenium << Previous | Next >> Automate Google Search
Comments
Post a Comment