Skip to content

nafizkamal11/web-automation-junit-selenium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Web Automation Project using ...

image

📊 Table of Contents

  1. Introduction
  2. 🖥️ Features
  3. 🧪 Test Cases Overview
  4. 🔒 Prerequisites
  5. 🚀 Project Setup
  6. 🏗️ Directory Structure
  7. 🔨 Configuration
  8. 🏷️ Known Issues

This project contains three test classes that automate various tasks using Selenium WebDriver with Java. Each class demonstrates a unique use case for web automation, including form submission, data scraping, and file handling.


🖥️ Features

  • Automated Form Filling and Validation
    • Tests the form-filling process on two different websites.
    • Handles file uploads, checkbox clicks, and form submission validations.
  • Web Scraping
    • Scrapes table data from a financial website and writes it to a text file.
  • Reusable Utility Functions
    • Scroll, wait, and interact with web elements using utility methods.
  • Headless Browser Support
    • Demonstrates scraping in a headless browser environment.

🧪 Test Cases Overview

1. Q1_DigitalUnite

Automates a form submission process on the Digital Unite Practice Form.

Key Features:

  • Handles cookie consent pop-ups.
  • Fills out text fields with sample data.
  • Uploads an image file and selects checkboxes.
  • Submits the form and validates the confirmation message.

Usage:

@Test
void digitalUnite_formFillUp_confirmationMessage()

Gradle Report:

image

2. Q2_wpEverest

Automates the registration process on the WP Everest Guest Registration Form.

Key Features:

  • Randomized email and password generation.
  • Selects dropdown values for nationality and country.
  • Handles radio buttons, checkboxes, and calendar inputs.
  • Validates success messages post-registration.

Usage:

@Test
void wpEverestFormFillUp_confirmationMessage()

Gradle Report:

image

3. Q3_dsebd

Scrapes table data from the DSEBD Latest Share Price page.

Key Features:

  • Operates in headless mode for efficient data extraction.
  • Extracts HTML table data and writes it to a text file.
  • Formats and logs the data for console output and storage.

Usage:

@Test
void scrapData_htmlTable_textFile()

Gradle Report:

image

🔒 Prerequisites

  1. Java Development Kit (JDK)

    Ensure JDK 8+ is installed and configured.

  2. Gradle

    Install Gradle or use the wrapper script provided.

  3. WebDriver

    Download and configure the appropriate WebDriver

  4. Dependencies

    Add the following dependencies to your build.gradle file.

    • Selenium Java
    • JUnit 5
    • Any required utilities for file handling or browser-specific configurations.

🚀 Project Setup

  1. Clone the repository:

    git clone https://github.com/your-username/selenium-automation-project.git
    cd selenium-automation-project
  2. Build the project:

    ./gradlew build
    
  3. Run the tests:

    ./gradlew test
    

🏗️ Directory Structure

src/
├── main/
│   ├── java/
│   └── resources/
└── test/
    ├── java/
    │   ├── Q1_DigitalUnite.java
    │   ├── Q2_wpEverest.java
    │   └── Q3_dsebd.java
    └── resources/
        ├── scrapData.txt
        └── myImage.jpg

🔨 Configuration

build.gradle

Ensure the following dependencies are included in your build.gradle:

dependencies {
    testImplementation platform('org.junit:junit-bom:5.10.0')
    testImplementation 'org.junit.jupiter:junit-jupiter'
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.27.0'
}

MyUtils

  • Custom Utility Class
  • Includes helper methods for tasks like scrolling, waiting, and handling repetitive actions.

🏷️Known Issues

  • File Path Configuration:

    Ensure the file paths for the resources (e.g., myImage.jpg, scrapData.txt) match your environment.

  • Delayed Form Validation:

    Some forms might display confirmation messages with a delay. The tests account for such cases with dynamic waits.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages