- Introduction
- 🖥️ Features
- 🧪 Test Cases Overview
- 🔒 Prerequisites
- 🚀 Project Setup
- 🏗️ Directory Structure
- 🔨 Configuration
- 🏷️ 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.
- 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.
Automates a form submission process on the Digital Unite Practice Form.
- 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.
@Test
void digitalUnite_formFillUp_confirmationMessage()
Automates the registration process on the WP Everest Guest Registration Form.
- Randomized email and password generation.
- Selects dropdown values for nationality and country.
- Handles radio buttons, checkboxes, and calendar inputs.
- Validates success messages post-registration.
@Test
void wpEverestFormFillUp_confirmationMessage()
Scrapes table data from the DSEBD Latest Share Price page.
- 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.
@Test
void scrapData_htmlTable_textFile()
-
Java Development Kit (JDK)
Ensure JDK 8+ is installed and configured.
-
Gradle
Install Gradle or use the wrapper script provided.
-
WebDriver
Download and configure the appropriate WebDriver
-
Dependencies
Add the following dependencies to your
build.gradle
file.- Selenium Java
- JUnit 5
- Any required utilities for file handling or browser-specific configurations.
-
Clone the repository:
git clone https://github.com/your-username/selenium-automation-project.git cd selenium-automation-project
-
Build the project:
./gradlew build
-
Run the tests:
./gradlew test
src/
├── main/
│ ├── java/
│ └── resources/
└── test/
├── java/
│ ├── Q1_DigitalUnite.java
│ ├── Q2_wpEverest.java
│ └── Q3_dsebd.java
└── resources/
├── scrapData.txt
└── myImage.jpg
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'
}
- Custom Utility Class
- Includes helper methods for tasks like scrolling, waiting, and handling repetitive actions.
-
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.