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 Webdriver
Continents
Selenium Commands

Upload Image 




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:
  1. Open this link - https://www.techlistic.com/p/selenium-practice-form.html
  2. Enter first and last name (textbox).
  3. Select gender (radio button).
  4. Select years of experience (radio button).
  5. Enter date.
  6. Select Profession (Checkbox).
  7. Select Automation tools you are familiar with (multiple checkboxes).
  8. Select Continent (Select box).
  9. Select multiple commands from a multi-select box.
  10. If you can handle Upload image then try it or leave this step.
  11. Click on the Download File link and handle the download file pop-up (leave it if you are a beginner).
  12. Click on Submit button.
  13. 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();
  }
}

Automate GoDaddy.com with Selenium << Previous | Next  >> Automate Google Search

Follow Techlistic

YouTube Channel | Facebook Page | Telegram Channel | Quora Space
If you like our blogs and tutorials, then sponsor us via PayPal

Comments

Popular posts from this blog

Top 7 Web Development Trends in the Market

Automation Practice: Automate Amazon like E-Commerce Website with Selenium

Mastering Selenium Practice: Automating Web Tables with Demo Examples

17 Best Demo Websites for Automation Testing Practice

Top Mobile Test Automation Tools for Efficient App Testing: Features and Cons

Web Automation Simplified By Virtual Ninja (Robot Framework)

Boost Your Career: Top 10 Job Search and Skill-Enhancing Websites for Success

Top Free YouTube Download Apps: Download YouTube Videos Software Free

Automate GoDaddy.com Features with Selenium WebDriver

14 Best Selenium Practice Exercises for Automation Practice