Online Job Application Form

  • Estimate Completion Time
    not found 1 hour
  • Difficulty Level:

Automate this form with Selenium to practice and experience various web elements with a diverse range of input fields commonly found in real-world projects.

Solution

package exercises;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;

public class Exercise7 {

	public static void main(String[] args) {

		WebDriver driver = new ChromeDriver();

		driver.get("https://proleed.academy/exercises/selenium/online-job-application-form.php");

		driver.findElement(By.id("name")).sendKeys("enter name");

		WebElement email = driver.findElement(By.id("email"));
		email.clear();
		email.sendKeys("example@gmail.com");

		driver.findElement(By.id("phone")).sendKeys("enter ");

		Select position = new Select(driver.findElement(By.name("position")));
		position.selectByVisibleText("Quality Analyst");

		driver.findElement(By.id("employed")).click();
		driver.findElement(By.id("resume")).sendKeys("C:\\Users\\Win-10\\Pictures\\Saved Pictures\\Sunscreen1.jpg");

		Select platform = new Select(driver.findElement(By.name("platform")));
		platform.selectByVisibleText("Google Search");

		driver.findElement(By.id("add")).click();
		Alert alert = driver.switchTo().alert();
		String alertText = alert.getText();
		String expectedalertText = "Your application has been submitted";
		System.out.println(alertText);

		if (expectedalertText.equals(alertText)) {
			System.out.println("Alert message is correct");
		} 
else {
			System.out.println("Unexpected alert message: " + alertText);
		}
		alert.dismiss();

	}

}
Selenium Automation Practice Exercises - QA Ads Banner

Proleed Academy

Proleed serves / offers professionally designed IT training courses
globally.

Copyright © 2023 - Proleed Academy | All Rights Reserved.