{"id":26538547,"url":"https://github.com/ritik-saxena/selenium-pom-junit","last_synced_at":"2026-05-03T10:37:18.645Z","repository":{"id":280916902,"uuid":"943579487","full_name":"Ritik-Saxena/selenium-pom-junit","owner":"Ritik-Saxena","description":"This Selenium test automation framework follows the Page Object Model (POM) for clean, maintainable tests. It includes handy utilities for waits, elements, logging, screenshots, and data-driven testing. Dynamic waits boost stability, and a regression suite keeps functionality in check. With Jenkins CI/CD, it ensures smooth, efficient automation.","archived":false,"fork":false,"pushed_at":"2025-03-21T00:49:41.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T01:32:22.273Z","etag":null,"topics":["apachepoi","automation","automation-framework","cicd","java","jenkins","junit4","maven","maven-pom","selenium","selenium-java","selenium-webdriver","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ritik-Saxena.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-05T23:56:22.000Z","updated_at":"2025-03-21T00:49:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2ade1a6-00cf-475d-b9a2-c18bf87cce1e","html_url":"https://github.com/Ritik-Saxena/selenium-pom-junit","commit_stats":null,"previous_names":["ritik-saxena/selenium-pom-junit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ritik-Saxena%2Fselenium-pom-junit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ritik-Saxena%2Fselenium-pom-junit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ritik-Saxena%2Fselenium-pom-junit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ritik-Saxena%2Fselenium-pom-junit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ritik-Saxena","download_url":"https://codeload.github.com/Ritik-Saxena/selenium-pom-junit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880659,"owners_count":20525515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apachepoi","automation","automation-framework","cicd","java","jenkins","junit4","maven","maven-pom","selenium","selenium-java","selenium-webdriver","testing"],"created_at":"2025-03-21T23:18:33.110Z","updated_at":"2026-05-03T10:37:18.639Z","avatar_url":"https://github.com/Ritik-Saxena.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg alt=\"selenium logo\" src=\"https://github.com/user-attachments/assets/892665fb-2f28-4f2d-be8d-155da5c14379\" align=\"right\" style: height=150 width=150 /\u003e\r\n\r\n\r\n# Selenium POM using JUnit: Element Interactions \u003cbr\u003e\r\n\u003e Connect with me on \u003ca href='https://www.linkedin.com/in/ritik-saxena'\u003eLinkedIn\u003c/a\u003e\r\n\r\n\u003cbr\u003e\r\n\r\n\r\n### 📝 **About the Project**  \r\n\r\n\r\nThis project is a **Selenium-based test automation framework** implemented using the **Page Object Model (POM)** to ensure modularity, reusability, and maintainability of test scripts. It covers **UI automation for various web interactions**, including **login functionality, alerts, drag-and-drop, dropdowns, frames, multiple windows, and web tables**.  \r\n\r\n🔹 **Key Features:**  \r\n- 🚀 **Page Object Model (POM):** Ensures a structured and scalable test design.  \r\n- 🛠 **Utility-Driven Approach:** Uses `ElementUtils.java`, `WaitUtils.java`, `ExcelUtils.java`, `LogUtils.java`, `ScreenshotUtils.java`, `BrowserUtils.java`, and `ConfigReader.java` for efficient automation.  \r\n- 📊 **Data-Driven Testing:** Implements `ExcelUtils.java` to parameterize test data dynamically.  \r\n- 📸 **Automated Screenshots:** Captures screenshots on test failures using `ScreenshotUtils.java`.  \r\n- 📝 **Logging \u0026 Reporting:** Uses `LogUtils.java` to track test execution status.\r\n- ⏳ **Asynchronous Waits:** Implemented dynamic waits in `WaitUtils.java` to handle element visibility and clickability efficiently.\r\n- 🔄 **Regression Testing:** Implemented **regression suite** to validate existing functionalities after updates.  \r\n- 🏗 **CI/CD Integration:** Configured **Jenkins Pipeline** to automate regression test execution.  \r\n\r\nThis framework ensures **robust test automation, reduces manual efforts, and integrates seamlessly into CI/CD pipelines for continuous testing.** 🚀✅\r\n\r\n\r\n\r\n\u003cbr\u003e\r\n\r\n\r\n## Folder Structure\r\n```\r\nselenium-pom/\r\n│── logs/\r\n│   ├── test.log\r\n│── src/\r\n│   ├── main/\r\n│   │   ├── java/\r\n│   │   │   ├── pages/\r\n│   │   │   │   ├── AlertPage.java\r\n│   │   │   │   ├── DragAndDropPage.java\r\n│   │   │   │   ├── DropdownPage.java\r\n│   │   │   │   ├── FramesPage.java\r\n│   │   │   │   ├── LoginPage.java\r\n│   │   │   │   ├── MulipleWindowsPage.java\r\n│   │   │   │   ├── WebTablePage.java\r\n│   │   │   ├── utils/\r\n│   │   │   │   ├── BrowserUtils.java\r\n│   │   │   │   ├── ConfigReader.java\r\n│   │   │   │   ├── ElementUtils.java\r\n│   │   │   │   ├── ExcelUtils.java\r\n│   │   │   │   ├── LogUtils.java\r\n│   │   │   │   ├── ScreenshotUtils.java\r\n│   │   │   │   ├── WaitUtils.java\r\n│   │   ├── resources/\r\n│   │   │   ├── LoginTestData.xlsx\r\n│   │   │   ├── config.properties\r\n│   │   │   ├── log4j2.xml\r\n│   ├── test/\r\n│   │   ├── java/\r\n│   │   │   ├── base/\r\n│   │   │   │   ├── BaseTest.java\r\n│   │   │   ├── tests/\r\n│   │   │   │   ├── RegressionsTestSuite.java\r\n│   │   │   │   ├── AlertTest.java\r\n│   │   │   │   ├── DragAndDropTest.java\r\n│   │   │   │   ├── DropdownTest.java\r\n│   │   │   │   ├── FramesTest.java\r\n│   │   │   │   ├── LoginTest.java\r\n│   │   │   │   ├── MulipleWindowsTest.java\r\n│   │   │   │   ├── WebTableTest.java\r\n│── target/\r\n│   ├── screenshots/\r\n│   │   ├── loginSuccess.png\r\n│── Jenkinsfile\r\n│── pom.xml\r\n```\r\n\r\n\r\n## **Common Automation Test Implementation Points** 🚀  \r\n\r\nThese are the common best practices followed across all test cases:\r\n\r\n* **Implemented Page Object Model (POM)** to maintain modularity and separation of concerns.\r\n* **Utilized explicit waits (WaitUtils) and ElementUtils** to ensure elements are properly loaded before interaction.\r\n* **Performed data-driven testing** (where applicable) to enhance test coverage and reusability.\r\n* **Implemented assertions** to validate expected behaviors for UI elements and actions.\r\n* **Used logging (LogUtils)** to track test execution status for better debugging and reporting.\r\n* **Captured screenshots (ScreenshotUtils)** for key test scenarios like successful actions or failures.\r\n* **Ensured structured test execution flow** by using proper setup methods before each test.\r\n* **Utilized essential utilities** (`ElementUtils`, `WaitUtils`, `ExcelUtils`, `LogUtils`, `ScreenshotUtils`, `BrowserUtils`, `ConfigReader`) to enhance test automation efficiency, ensuring reliable element interactions, explicit waits, data-driven testing, logging, screenshot capturing, and configuration management.\r\n\r\n\u003cbr\u003e\r\n\r\n## Test Preview\r\n### 🔑 Login Test\r\n\r\n* Worked with text field interaction using `enterUsername()` and `enterPassword()` methods.\r\n* Performed **data parameterization for login credentials using Apache POI** via `ExcelUtils`.\r\n* Ensured secure credential retrieval via `ConfigReader` utility for application properties.\r\n* Validated login functionality for both **valid and invalid credentials**.\r\n* Implemented a **dynamic test execution flow using data-driven testing** via Excel.\r\n* Ensured **proper test reporting using logs and status messages**.\r\n\r\nhttps://github.com/user-attachments/assets/7bb2c04e-a689-4e82-b700-4e29f1dce158\r\n\r\n\u003cbr\u003e\r\n\r\n### ⚠️ Alert Test\r\n\r\n* Automated **JavaScript alert handling**, including simple, confirmation, and prompt alerts.\r\n* Used **Selenium's alert interface** to accept, dismiss, and send text to alerts.\r\n* **Validated alert responses using assertions** to ensure expected results.\r\n* Tested **multiple alert behaviors**, such as **OK and Cancel actions for confirmation alerts**.\r\n* Performed **text input automation for JavaScript prompt** alerts.\r\n\r\nhttps://github.com/user-attachments/assets/aa887aa5-ef99-4948-a4d8-d63923d4e7b0\r\n\r\n\u003cbr\u003e\r\n\r\n### 🖱 Drag And Drop Test\r\n\r\n* **Automated drag-and-drop** functionality using Selenium’s **`Actions` class**.\r\n* Performed element interactions using Actions class for smooth drag-and-drop execution.\r\n* Validated UI behavior by simulating user actions programmatically.\r\n\r\nhttps://github.com/user-attachments/assets/b8e6cf5a-0ab1-4961-a354-29c7352a77e8\r\n\r\n\u003cbr\u003e\r\n\r\n### 📌 Dropdown Test\r\n\r\n* **Automated dropdown selection** testing using Selenium’s **`Select` class**.\r\n* Performed dropdown selection using multiple methods:\r\n  * **By value**\r\n  * **By visible text**\r\n  * **By index**\r\n* **Validated selected dropdown options using assertions** to ensure correct selection.\r\n* Created **structured and reusable methods** for dropdown interactions to improve maintainability.\r\n* **Logged dropdown selection actions** using `LogUtils` for better test tracking.\r\n\r\nhttps://github.com/user-attachments/assets/28531409-6134-440c-8056-0c38c2e1e5b2\r\n\r\n\u003cbr\u003e\r\n\r\n### 🖼 Frames Test\r\n* Automated **frame handling and switching** using Selenium’s ```switchTo().frame()``` methods.\r\n* Ensured **proper frame navigation** and interactions with embedded elements inside frames..\r\n\r\nhttps://github.com/user-attachments/assets/530b4f11-46e3-4fe3-ba24-669649d9cbbd\r\n\r\n\u003cbr\u003e\r\n\r\n### 🪟 Muliple Windows Test\r\n* Automated **multiple window handling** using Selenium’s ```switchTo().window()``` methods.\r\n* Performed **dynamic window switching** by both tab number and window title.\r\n* Validated UI behavior by **asserting window titles after switching**.\r\n* Implemented **efficient window management by allowing selective and bulk window closures**.\r\n\r\nhttps://github.com/user-attachments/assets/5cb11e22-5312-44eb-b84c-25591116ae7b\r\n\r\n\u003cbr\u003e\r\n\r\n### 📊 WebTable Test\r\n* Automated **web table validation** by retrieving and verifying column headers dynamically.\r\n* **Extracted table data dynamically** for structured and efficient data retrieval.\r\n* **Validated column headers** against expected values to ensure correct table structure.\r\n* Implemented **a reusable method to fetch all rows** for scalable test cases.\r\n\r\nhttps://github.com/user-attachments/assets/09f8a8f6-96f4-48c8-aa2f-dc5c44ca49dd\r\n\r\n\r\n\u003cbr\u003e\r\n\r\n## Detailed Logs\r\nImplemented custom logging to track test execution, including **INFO**, **ERROR**, and **WARNING** logs. These logs provide visibility into test execution flow, failures, and key actions performed during test runs.\r\n\r\n### 📄 Sample Logs (`logs/test.log`)\r\n```\r\n2025-03-05 07:41:48 [main] INFO  utils.LogUtils - [tests.LoginTest.testValidLogin:37] - Login successful: You logged into a secure area!\r\n2025-03-05 07:41:52 [main] INFO  utils.LogUtils - [tests.LoginTest.testLoginWithExcelData:80] - Starting login test with Excel data...\r\n2025-03-05 07:41:54 [main] INFO  utils.LogUtils - [tests.LoginTest.testLoginWithExcelData:94] - Attempting login for user: demo\r\n2025-03-05 07:41:55 [main] ERROR utils.LogUtils - [tests.LoginTest.testLoginWithExcelData:106] - Failed to login!\r\n2025-03-05 07:41:55 [main] INFO  utils.LogUtils - [tests.LoginTest.testLoginWithExcelData:94] - Attempting login for user: tomsmith\r\n2025-03-05 07:41:56 [main] INFO  utils.LogUtils - [tests.LoginTest.testLoginWithExcelData:104] - Login Successful!\r\n2025-03-05 07:41:56 [main] INFO  utils.LogUtils - [tests.LoginTest.testLoginWithExcelData:113] - Excel test completed. Data saved.\r\n2025-03-05 07:42:03 [main] INFO  utils.LogUtils - [tests.LoginTest.testValidLoginAndTakeScreenshot:67] - You logged into a secure area!\r\n2025-03-05 07:42:03 [main] INFO  utils.LogUtils - [tests.LoginTest.testValidLoginAndTakeScreenshot:71] - Login successful: You logged into a secure area!\r\n2025-03-05 07:42:03 [main] INFO  utils.LogUtils - [utils.ScreenshotUtils.takeScreenshot:21] - Screenshot taken successfully!\r\n2025-03-05 07:42:10 [main] INFO  utils.LogUtils - [tests.LoginTest.testInvalidLogin:53] - Login failed as expected: Your username is invalid!\r\n2025-03-05 07:43:10 [main] INFO  utils.LogUtils - [tests.DropdownTest.validateDropdown:31] - Selected dropdown option: Option 1\r\n2025-03-05 07:43:11 [main] INFO  utils.LogUtils - [tests.DropdownTest.validateDropdown:36] - Selected dropdown option: Option 2\r\n2025-03-05 07:43:11 [main] INFO  utils.LogUtils - [tests.DropdownTest.validateDropdown:41] - Selected dropdown option: Option 1\r\n```\r\n\r\n\u003cbr\u003e\r\n\r\n## CI/CD Integration using Jenkins\r\n\r\nBelow are the pipeline stages performed for the project.\r\n\r\n1. **Checkout Code:** Pulls the latest test scripts from GitHub.\r\n2. **Set Up Dependencies:** Runs `mvn clean install -DskipTests` to set up project dependencies.\r\n3. **Regression Test Execution:**\r\n   * Executes `mvn test -Dtest=RegressionTestSuite`.\r\n   * Runs all test classes listed under RegressionTestSuite.\r\n5. **Reporting and Archiving the artifact:**\r\n    * JUnit Test Reporting: Collects test execution results from `surefire-reports`.\r\n    * Artifact Archiving: Stores test reports for future reference.\r\n\r\n![Jenkins build](https://github.com/user-attachments/assets/b8b689ec-7845-4a04-9bf9-bc15e65e1fab)\r\n\r\n![Jenkins Blue Ocean](https://github.com/user-attachments/assets/5e5cfff0-d6a1-4a5f-af2b-af5c84bc445d)\r\n\r\n--- \r\nIf you like this repository, do \u003cimg src=\"https://user-images.githubusercontent.com/62079355/200077014-f3e95bba-57a6-4c7a-b26a-212bf18e5162.png\" width=25 height=25\u003e and \u003cimg src=\"https://user-images.githubusercontent.com/62079355/220893415-ea2015e9-6df6-4de2-ab66-041a3f890be2.png\" width=25 height=25\u003e the repo for more amazing stuff coming soon.\r\n\r\n---\r\n[![GitHub stars](https://img.shields.io/github/stars/Ritik-Saxena/selenium-pom-junit?style=social)](https://github.com/Ritik-Saxena/selenium-pom-junit)\r\n[![GitHub followers](https://img.shields.io/github/followers/Ritik-Saxena?style=social)](https://github.com/Ritik-Saxena?tab=followers)\r\n[![GitHub forks](https://img.shields.io/github/forks/Ritik-Saxena/selenium-pom-junit?style=social)](https://github.com/Ritik-Saxena/selenium-pom-junit)\r\n[![GitHub watchers](https://img.shields.io/github/watchers/Ritik-Saxena/selenium-pom-junit?style=social)](https://github.com/Ritik-Saxena/selenium-pom-junit)\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritik-saxena%2Fselenium-pom-junit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fritik-saxena%2Fselenium-pom-junit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritik-saxena%2Fselenium-pom-junit/lists"}