Skip to content

utkarshupadhyay-qa/Py2XWebAutomationProgram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Python Web Automation Programs

Dep

pip install pytest pytest-html selenium allure-pytest openpyxl

Certainly! Here's the updated Markdown documentation with the addition of allure-pytest and the requested Selenium topics:


Selenium with Pytest and Framework Documentation

Introduction

This documentation provides guidance on using Selenium with Pytest along with a framework for efficient web testing in Python. Selenium is a powerful tool for automating web browsers, and Pytest is a popular testing framework in Python. Combining them with a framework structure enhances maintainability and scalability of test suites. Additionally, allure-pytest is used for generating detailed test reports.

Installation

  1. Python: Ensure Python is installed on your system. You can download and install Python from the official website.

  2. Selenium: Install Selenium using pip:

    pip install selenium
    
  3. Pytest: Install Pytest using pip:

    pip install pytest
    
  4. Allure-Pytest: Install allure-pytest for generating detailed test reports:

    pip install allure-pytest
    

Getting Started

  1. Clone the Repository: Clone the repository containing the Selenium tests and framework.

  2. Install Dependencies: Navigate to the project directory and install dependencies by running:

    pip install -r requirements.txt
    
  3. Configuration: Configure your test environment by modifying configuration files as per your requirements.

  4. Writing Tests: Write your Selenium tests using Pytest syntax. Ensure tests are organized within the framework structure.

Framework Structure

The framework follows a modular structure for better organization and scalability. Here's an overview:

  • tests/: This directory contains test files written using Pytest.

  • pages/: Contains Page Object classes representing web pages. Each page object encapsulates the functionality and elements of a particular web page.

  • utilities/: Utility functions and helper classes that aid in test automation.

  • config/: Configuration files for managing test environments and settings.

  • reports/: Directory for storing test reports generated during test execution.

Writing Tests

  1. Setup and Teardown: Use fixture functions provided by Pytest for setup and teardown operations before and after tests.

  2. Page Objects: Utilize Page Object design pattern to represent web pages and interact with elements within them.

  3. Assertions: Use Pytest's built-in assertion mechanisms to verify expected outcomes.

  4. Parameterization: Parameterize tests to run with different datasets, enhancing test coverage.

  5. Allure Reporting: Utilize allure-pytest for generating detailed test reports.

Running Tests

Execute tests using Pytest command-line interface:

pytest --alluredir=./reports

Optionally, you can specify specific tests or directories:

pytest path/to/test_file.py

Generating Reports

After test execution, reports will be generated in the reports/ directory. These reports provide detailed information on test results, including passed, failed, and skipped tests. You can view the reports by running:

allure serve reports/

Selenium Topics

PyTest

  • Install pytest: Use pip to install pytest.
  • Create your first test: Write a simple test using Pytest.
  • Run multiple tests: Execute multiple tests using Pytest.
  • Assert that a certain exception is raised: Verify specific exceptions are raised during test execution.
  • Group multiple tests in a class: Organize tests into classes for better management.

Selenium with Python

  • What is Selenium: Introduction to Selenium and its role in web automation.
  • Why Selenium? / Advantages: Benefits of using Selenium for web testing.
  • What are its versions?: Overview of Selenium versions and their features.
  • What all OS, Browsers, and Programming Languages does it Support?: Compatibility matrix for Selenium.
  • Java-Selenium Architecture: Overview of Selenium architecture with Java.
  • Selenium vs Playwright vs Cypress: Comparison between Selenium, Playwright, and Cypress.
  • WebDriver Architecture , Selenium IDE, Selenium Grid 3, 4: Detailed explanation of WebDriver architecture, Selenium IDE, and Selenium Grid versions.
  • Basic Selenium Program to Open and close Browser: Sample code for opening and closing a browser using Selenium.
  • Runtime Polymorphism Program in Selenium WebDriver abstract methods: Example demonstrating runtime polymorphism in Selenium.
  • Locators XPath, its Types and cases: Explanation of XPath locators and their types.
  • Handling Multiple Elements: Techniques for handling multiple elements on a web page.
  • Handling Synchronization issue by using implicitly Wait and Explicit Wait: Strategies for handling synchronization issues in Selenium.
  • Handling Dropdown (static and dynamic): Methods for interacting with dropdown menus in Selenium.
  • Handling Keyboard and Mouse Actions: Performing keyboard and mouse actions using Selenium.
  • Taking Screenshot, Handling Disabled Element, Performing Scroll down: Capturing screenshots, handling disabled elements, and scrolling down a web page using Selenium.
  • Action WebElement Interface Methods, Handling Popups (web-based and Window-based), Shadow DOM, SVG, Web tables: Advanced Selenium features for interacting with web elements, handling popups, working with Shadow DOM, SVG, and Web tables.
  • Handling Frames and Handling New Windows/New Tabs: Techniques for handling frames and managing new windows or tabs in Selenium.
  • Custom Automation Framework: Designing and implementing a custom automation framework for Selenium tests.
  • New Selenium 4.x+: Features and improvements introduced in Selenium 4 and later versions.
  • Cloud Testing - BrowserStack Demo: Demonstration of cloud testing using BrowserStack.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages