{"id":23357273,"url":"https://github.com/shazid18/selenium_automation_testing","last_synced_at":"2025-04-07T20:13:09.633Z","repository":{"id":267576743,"uuid":"899518062","full_name":"Shazid18/Selenium_Automation_Testing","owner":"Shazid18","description":"This project is designed to automate the testing of a vacation rental details page to validate essential elements and functionality by ensuring code re-usability. The tests ensure that the webpage meets SEO and functional standards.","archived":false,"fork":false,"pushed_at":"2024-12-11T05:53:42.000Z","size":89,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T20:13:05.707Z","etag":null,"topics":["python","selenium"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Shazid18.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-12-06T12:37:58.000Z","updated_at":"2025-01-02T19:55:27.000Z","dependencies_parsed_at":"2024-12-11T06:31:59.216Z","dependency_job_id":"abd3db0e-f1df-4edf-be10-8b8136a060fd","html_url":"https://github.com/Shazid18/Selenium_Automation_Testing","commit_stats":null,"previous_names":["shazid18/selenium_automation_testing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shazid18%2FSelenium_Automation_Testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shazid18%2FSelenium_Automation_Testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shazid18%2FSelenium_Automation_Testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shazid18%2FSelenium_Automation_Testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shazid18","download_url":"https://codeload.github.com/Shazid18/Selenium_Automation_Testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247721921,"owners_count":20985084,"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":["python","selenium"],"created_at":"2024-12-21T10:19:57.524Z","updated_at":"2025-04-07T20:13:09.614Z","avatar_url":"https://github.com/Shazid18.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vacation Rental Home Page Automation Testing\n\n ## Table of Contents\n  \n  1. [Project Overview](#project-overview)\n  2. [Features](#features)\n  3. [Project Structure](#project-structure)\n  4. [Getting Started](#getting-started)\n     - [Prerequisites](#prerequisites)\n     - [Dependencies](#dependencies)\n     - [Installation](#installation)\n  6. [Usage](#usage)\n  7. [Reusability of Code](#reusability-of-code)\n\n## Project Overview\n\nThis project is designed to automate the testing of a vacation rental details page to validate essential elements and functionality. The tests ensure that the webpage meets SEO and functional standards.\n\n\n\n\n## Features\n\n- **H1 tag existence**: Checks if the H1 tag is present on the page.\n\n- **HTML tag sequence**: Ensure proper order of H1-H6 tags and also in correctly sequenced.\n\n- **Image alt attribute**: Validates that all images have proper alt attributes for SEO purposes.\n\n- **URL status code**: Verifies the HTTP status of all URLs on the page to ensure there are no broken links. (i.e., not 404).\n\n- **Currency filter functionality**: Verify that currency changes on the page update the property tiles accordingly.\n\n- **Script data extraction**: Extract critical site information (like SiteURL, CampaignID, etc.) and record it into an Excel file.\n\nThe results of each test are recorded in an Excel file with detailed comments on pass/fail criteria.\n\n\n## Project Structure\n  \n  ```plaintext\n\n     Selenium_Automation_Testing/\n      ├── config/\n      │   └── config.py               # Configuration settings (e.g., URLs, credentials)\n      ├── tests/\n      │   ├── __init__.py             # Makes 'tests' a package\n      │   ├── h1_existence.py         # Checks for the presence of \u003ch1\u003e tags\n      │   ├── heading_sequence.py     # Verifies the sequence of headings\n      │   ├── image_alt_attributes.py # Tests for missing or empty alt attributes in images\n      │   ├── scrape_data.py          # Scrapes data from pages\n      │   ├── test_currency.py        # Tests currency functionality\n      │   └── urls_status.py          # Verifies the status of URLs\n      ├── utils/\n      │   ├── __init__.py             # Makes 'utils' a package\n      │   ├── driver_setup.py         # WebDriver setup and initialization\n      │   ├── excel_handler.py        # Handles Excel file operations\n      │   └── url_checker.py          # Utility for checking URL statuses\n      ├── .gitignore                  # Specifies files and directories to ignore in Git\n      ├── README.md                   # Project documentation\n      ├── automation_report.xlsx      # Output file for test results\n      ├── main.py                     # Entry point for executing tests\n      ├── requirements.txt            # Python dependencies for the project\n      ├── script_data.xlsx            # Input data for tests (if any)\n      └── test.py                     # Script for running or debugging specific tests\n\n  ```\n\n\n\n\n  ## Getting Started\n  \n### Prerequisites\n\n1. **Python**  \n   - Version \u003e= 3.8  \n   - [Download Python](https://www.python.org/downloads/)\n\n2. **Browser**  \n   - Google Chrome or Mozilla Firefox must be installed. (Chrome recommended) \n   - [Download Google Chrome](https://www.google.com/chrome/)  \n   - [Download Firefox](https://www.mozilla.org/firefox/)\n\n3. **WebDriver Manager**\n    - The project uses the `webdriver_manager` library to automatically download and manage the appropriate WebDriver version, so no manual WebDriver installation is required.\n\n\n### Dependencies\n\nThis project requires the following Python packages:\n\n- **selenium**: For browser automation.\n- **pandas**: For Excel report generation.\n- **openpyxl**: For writing to Excel files.\n- **requests**: For handling HTTP requests.\n- **webdriver-manager**: For automatically managing WebDriver installations.\n\n### Installation\n  \n  1. Clone the repository:\n     ```bash\n     git clone https://github.com/Shazid18/Selenium_Automation_Testing.git\n     cd Selenium_Automation_Testing\n     ```\n  \n  2. Set up a virtual environment:\n     ```bash\n     python3 -m venv venv\n     ```\n     \n  3. Activate the virtual environment:\n     ```bash\n     source venv/bin/activate   # On Windows: venv\\Scripts\\activate\n     ```\n  \n  4. Install dependencies:\n     ```bash\n     pip install -r requirements.txt\n     ```\n\n\n## Usage\n\n### Set up the configuration:\n- Make sure `config/config.py` contains the correct settings for your ChromeDriver and other configuration options.\n\n- To change the test webpage, simply change the BASE_URL in the `config/config.py` file. (Currently set to the vacation rental page [https://www.alojamiento.io/property/apartamentos-centro-col%c3%b3n/BC-189483])\n\n- By default, the project uses `webdriver-manager` to download the correct version of ChromeDriver automatically. However, if you want to manually specify the driver path, set `USE_CHROMEDRIVER_MANAGER = False` in `config/config.py`.\n\n- **Headless Mode:** To run the tests in headless mode (without opening a browser window), you can toggle the `HEADLESS_MODE` setting in the `config/config.py` file:\n   - Set `HEADLESS_MODE = True` for headless mode.\n   - Set `HEADLESS_MODE = False` for normal browser mode.\n\n   This allows you to run tests without launching the browser UI, which is useful for CI/CD environments or automated testing.\n\n### Running the tests:\n- You can run the tests using the main.py script. This script will automatically:\n     - Set up the Selenium WebDriver.\n     - Run the tests for h1 tag existence, html tag sequence, image alt attribute validation, URLs check, currency filter, and data extraction.\n     - Store the results in an Excel report.\n\n     To run the tests, execute:\n     ```bash\n     python main.py \n     ```\n### Test Results:\n- The results are stored in `automation_report.xlsx`. Each test writes its results to a separate sheet in the same Excel file. The file will include detailed information about each test, such as the tested page url, test case name, pass/fail status and comments.\n\n### Scrape data from Script data: \n- Extracts important information such as Site URL, Campaign ID, SiteName, Browser, CountryCode and IP from the page and stored those information in `script_data.xlsx` file.\n\n## Reusability of Code\n\nCode is divided into smaller modules (`config/`, `utils/` and `tests/`) based on their responsibilities. Modules can be reused independently in new projects or extended without affecting unrelated code.\n\n### `config/config.py`\nContains configuration for the browser options, WebDriver, Base_URL (tested url path) and other settings.\n\n### `tests/`\nContains individual test scripts:\n\n- **SEO Tests**:\n    - `h1_existence.py`: Tests the existence of `\u003ch1\u003e` tags on the website.\n    - `heading_sequence.py`: Validates the correct order of heading tags.\n    - `image_alt_attributes.py`: Ensures that images have appropriate alt attributes.\n    - `urls_status.py`: Checks the status of URLs on the website.\n  \n- **Currency Filter Test**:\n    - `test_currency.py`: Tests whether the currency filter works as expected on the website.\n\n- **Scrape Data**:\n    - `scrape_data.py`: Extracts data (like Site URL, Campaign ID, etc.) and stores it in an Excel file.\n\n### `utils/`\nContains utility modules: Encapsulates the WebDriver setup, making it reusable across all test scripts and handles Excel report generation in a reusable way.\n\n- `driver_setup.py`: Sets up the Selenium WebDriver.\n- `excel_handler.py`: Handles reading and writing data to Excel files.\n- `url_checker.py`: Validates the URLs on the site.\n\n### `main.py`\nThis is the main script that ties everything together and runs the tests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshazid18%2Fselenium_automation_testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshazid18%2Fselenium_automation_testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshazid18%2Fselenium_automation_testing/lists"}