{"id":22408980,"url":"https://github.com/noushinb/selenium-webdriver-java-testing-example","last_synced_at":"2025-10-15T19:31:22.692Z","repository":{"id":249705689,"uuid":"831079936","full_name":"NoushinB/Selenium-WebDriver-Java-Testing-Example","owner":"NoushinB","description":"This repository demonstrates using Selenium WebDriver with Java, JUnit, BDD, Cucumber, and Gherkin for browser automation and UI testing. It includes a framework for WebDriver management, reusable UI methods, page objects, and example tests with scenarios.","archived":false,"fork":false,"pushed_at":"2025-03-01T22:40:10.000Z","size":1676,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T11:37:17.008Z","etag":null,"topics":["bdd","cucumber","gherkin","java","junit","page-object-model","qa-automation","selenium","selenium-webdriver-java-junit-cucumber-gherkin","test-automation"],"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/NoushinB.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":"2024-07-19T15:59:07.000Z","updated_at":"2025-03-20T08:14:51.000Z","dependencies_parsed_at":"2024-10-27T18:06:00.957Z","dependency_job_id":"5faa94b4-babf-4151-8734-ba3ff8553b9c","html_url":"https://github.com/NoushinB/Selenium-WebDriver-Java-Testing-Example","commit_stats":null,"previous_names":["noushinb/onlineclothingstoreautomationtest","noushinb/selenium-webdriver-java-testing-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NoushinB/Selenium-WebDriver-Java-Testing-Example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoushinB%2FSelenium-WebDriver-Java-Testing-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoushinB%2FSelenium-WebDriver-Java-Testing-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoushinB%2FSelenium-WebDriver-Java-Testing-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoushinB%2FSelenium-WebDriver-Java-Testing-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NoushinB","download_url":"https://codeload.github.com/NoushinB/Selenium-WebDriver-Java-Testing-Example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoushinB%2FSelenium-WebDriver-Java-Testing-Example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279107212,"owners_count":26105223,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bdd","cucumber","gherkin","java","junit","page-object-model","qa-automation","selenium","selenium-webdriver-java-junit-cucumber-gherkin","test-automation"],"created_at":"2024-12-05T12:06:05.249Z","updated_at":"2025-10-15T19:31:22.687Z","avatar_url":"https://github.com/NoushinB.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Selenium WebDriver Java Testing Example\n\nThis repository provides an example of using **Selenium WebDriver** with **Java**, **JUnit**, **Cucumber**, and **Gherkin** for browser automation and UI testing. It includes a simple framework for managing WebDriver instances, reusable UI methods, page objects, and example tests that interact with a web form on [Boni García's Selenium WebDriver page](https://bonigarcia.dev/selenium-webdriver-java/web-form.html).\n\nThe tests are written using the **Cucumber** framework in **Gherkin** syntax, which allows for behavior-driven development (BDD) style scenarios. **JUnit** is used as the test runner to execute the feature files.\n\n\n## Overview\n\nThis project demonstrates how to build a basic Selenium WebDriver testing framework in Java. The repository contains:\n\n- **Driver management** with thread-safe WebDriver instances.\n- **Reusable UI methods** and **page objects** for interacting with web elements.\n- **Sample test scenarios** that cover various web components (text input, password fields, checkboxes, dropdowns, etc.).\n- **Cucumber-based feature files** for defining test scenarios in a behavior-driven development (BDD) style.\n\n## Cucumber-Based Feature Files  \n\nThis repository includes comprehensive Cucumber feature files written in Gherkin syntax. These files define test scenarios for behavior-driven development (BDD) and cover a wide range of functionalities:  \n\n- **Infinite Scroll**:  \n  - Validates dynamic content loading as the user scrolls to the bottom of the page.  \n  - Ensures new content is appended without triggering a full-page reload.  \n\n- **Drag and Drop**:  \n  - Tests drag-and-drop functionality, verifying that elements are repositioned correctly.  \n\n- **Dropdown Menu Interaction**:  \n  - Scenarios for interacting with dropdown buttons and verifying menu item visibility and selection.  \n\n- **Home Page Navigation**:  \n  - Tests navigation to various pages using specific buttons on the home page.  \n\n- **Web Form Components**:  \n  - Covers interaction with various form elements, including:  \n    - Text inputs and password fields.  \n    - Dropdown menus (select and data list).  \n    - File uploads.  \n    - Checkboxes and radio buttons.  \n    - Date picker, color picker, and range slider components.  \n\n- **Navigation Page**:  \n  - Validates button interactions and dynamic content updates.  \n\n- **Login Functionality**:  \n  - Validates user authentication by testing login attempts with valid and invalid credentials.  \n  - Ensures appropriate success or error messages are displayed based on login attempts.  \n\n- **Button Functionalities**:  \n  - Verifies interactions with alert, confirm, and prompt dialogs.  \n  - Ensures correct messages are displayed when accepting, canceling, or inputting text in prompt dialogs.  \n  - Tests modal dialogs for expected behavior when closed or when changes are saved.\n \n \n## Class Structure:\n\n### `core.drivers`\n\n- **`DriverManager`**\n  - Manages web driver instances for multiple threads.\n  - Likely includes methods for creating, getting, and removing WebDriver instances in a thread-safe manner.\n\n- **`DriverProvider`**\n  - Provides the necessary WebDriver instances (like Chrome or Firefox).\n  - Handles configurations like ChromeOptions for setting up the driver (i.e., headless mode, browser-specific properties, etc.).\n  - Likely manages different browsers and timeout configurations.\n\n---\n\n### `core.library`\n\n- **`Constants`**\n  - Contains static final variables used throughout the test, such as timeouts, URL constants, browser names, etc.\n\n- **`PropertyLoader`**\n  - A Singleton class designed to load configuration properties (i.e., from `.properties` files) and ensure that only one instance of the class is used throughout the tests.\n  - Ensures centralized and controlled access to configuration values.\n\n---\n\n### `pages.browseragnosticfeatures`\n\n- **`DialogBoxPage`**\n  - A Page Object that deals with browser-agnostic features like dialog boxes.\n  - Contains logic for interacting with alerts and dialog elements (using `Alert` and `WebDriverWait`).\n\n- **`InfiniteScrollingPage`**\n  - A Page Object handling infinite scroll features in the web application.\n  - Contains interactions and waits that are unique to infinite scrolling scenarios.\n\n---\n\n### `pages.common`\n\n- **`BasePage`**\n  - The base class for all pages that could have common elements or actions that every page shares.\n  - Most likely, this class contains a constructor for page factory initialization (with `PageFactory.initElements(driver, this)`).\n  - Also includes driver and WebDriver-specific methods.\n\n---\n\n### `pages.pageobjectmodel`\n\n- **`LoginFormPage`**\n  - A Page Object model for login form interactions (like entering credentials, clicking login buttons, etc.).\n  - Contains specific methods for interacting with the login form.\n\n---\n\n### `pages.webDriverFundamentals.webform_components`\n\n- **`WebFormComponentsPage`**\n  - A Page Object for handling form components such as text fields, checkboxes, dropdowns, etc.\n  - Includes elements like `WebFormTextElement` to distinguish different types of form inputs.\n\n- **`WebFormTextElement` (Enum)**\n  - An enumeration that identifies different types of text-based form fields like `PASSWORD`, `TEXT`, and `TEXT_AREA`.\n\n---\n\n### `pages.webDriverFundamentals`\n\n- **`DragAndDropPage`**\n  - A Page Object dedicated to drag-and-drop interactions.\n  - Contains logic to simulate drag-and-drop events using WebDriver.\n\n- **`DropDownMenuPage`**\n  - A Page Object for interacting with dropdown menus in the web application.\n  - Includes methods for selecting items from dropdowns and checking the current selection.\n\n- **`HomePage`**\n  - A Page Object for the main or home page of the web application.\n  - Contains methods for interacting with elements on the home page.\n\n- **`NavigationPage`**\n  - A Page Object for handling navigation-related elements or interactions on the site (like menus or sidebars).\n\n---\n\n### `hooks`\n\n- **`Hooks`**\n  - A Cucumber hook class that initializes or terminates the test execution.\n  - Contains methods annotated with `@Before` and `@After` to set up or tear down things like WebDriver instances before and after the tests.\n\n---\n\n### `steps.browseragnosticfeatures`\n\n- **`DialogBoxStepDefinitions`**\n  - Step definition class that defines the steps for handling dialog boxes in tests.\n  - Steps might include clicking buttons on the dialog, verifying alert messages, etc.\n\n- **`InfiniteScrollingStepDefinitions`**\n  - Step definition class that defines steps for interacting with infinite scrolling pages, such as scrolling until an element is visible.\n\n---\n\n### `steps.pageobjectmodel`\n\n- **`LoginFormStepDefinitions`**\n  - Step definition class with steps to interact with the login form (filling out username/password fields and submitting the form).\n\n---\n\n### `steps.webdriverfundamentals`\n\n- **`DragAndDropStepDefinitions`**\n  - Step definition class for defining actions related to drag-and-drop functionality.\n   \n- **`DropDownMenuStepDefinitions`**\n  - Step definition class that includes steps for interacting with dropdown menus in the tests.\n\n- **`HomeStepDefinitions`**\n  - Step definition class for testing interactions on the home page.\n   \n- **`NavigationStepDefinitions`**\n  - Step definition class for interactions related to navigation elements.\n\n- **`WebFormComponentsStepDefinitions`**\n  - Step definition class for interacting with web form components like input fields, buttons, and dropdowns.\n\n---\n\n### `RunCucumberTest`\n- The test runner class that uses Cucumber to run the tests.\n- Defines the location of feature files and configures reporting options for the test execution.\n\n\n  ## Test Reports\n\nAfter running the tests, you can find the test execution reports in the `target` directory. The reports are generated in HTML format, providing a detailed overview of the test results.\n\n![Test Report ](https://github.com/NoushinB/Selenium-WebDriver-Java-Testing-Example/blob/master/src/test/resources/files/report.png) \n\n---\n\n## Test Execution Demo\n    \n\n[![Watch the RestAssured-API-Testing DEMO](https://github.com/NoushinB/Selenium-WebDriver-Java-Testing-Example/blob/master/src/test/resources/files/Demo.png?raw=true)](https://youtu.be/USy0EVfLg2s)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoushinb%2Fselenium-webdriver-java-testing-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoushinb%2Fselenium-webdriver-java-testing-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoushinb%2Fselenium-webdriver-java-testing-example/lists"}