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

Comments

Popular posts from this blog

What Role Graphic Design Services Play in Marketing

Python Behave Tutorial: A Comprehensive Guide to Behavior-Driven Development (BDD)

Testing a Web Page/Website: Best Practices for Quality Assurance and Improved User Experience

7 Best Sites for Free Music Downloads

Mastering Selenium WebDriver: 25+ Essential Commands for Effective Web Testing

Mastering Selenium Practice: Automating Web Tables with Demo Examples

Top Free YouTube Download Apps: Download YouTube Videos Software Free

Evolution of Artificial Intelligence Chat Bots: From ELIZA to Chat GPT

How to Automate Google Search with Selenium WebDriver

Top 10 Highly Paid Indian CEOs in the USA