Skip to content
View fanyty's full-sized avatar

Block or report fanyty

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
fanyty/README.md

Web Automation Framework

This is a web automation testing framework using Selenium and Pytest.

Project Structure

web_automation_framework/

├── config/

│ ├── init.py

│ ├── config.py

│ └── logger.py

├── tests/

│ ├── init.py

│ └── test_group.py

├── pages/

│ ├── init.py

│ ├── login_page.py

│ ├── group_page.py

│ └── base_page.py

├── utils/

│ └── init.py

├── reports/

│ └── init.py

├── requirements.txt

├── conftest.py

├── pytest.ini

└── README.md

Setup

Prerequisites

  • Python 3.12
  • pip (Python package installer)
  • Chrome browser
  • ChromeDriver (ensure the version matches your Chrome browser version)

Installation

  1. Clone the repository:

    git clone https://github.com/fanyty/fanyty/web_automation_framework.git
    cd web_automation_framework
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Download ChromeDriver:

    • Download the ChromeDriver from ChromeDriver Download.
    • Place the chromedriver.exe in the web_automation_framework directory.

Running Tests

To run the tests and generate an HTML report:

pytest tests/test_group.py --html=reports/test_report.html

he HTML report will be generated in the reports directory.

Configuration
config/config.py
Update the configuration settings as per your requirements:
class Config:
    BASE_URL = "https://example.com"
    USERNAME = "test_user"
    PASSWORD = "test_password"
    TIMEOUT = 10
Logging
Logging is configured in config/logger.py:
import logging

def setup_logger():
    logger = logging.getLogger("web_automation")
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    return logger

logger = setup_logger()
Directory Structure
config: Contains configuration files and logger setup.
tests: Contains test cases.
pages: Contains page object models.
utils: Contains utility functions (if any).
reports: Contains test reports.
conftest.py: Contains pytest fixtures.
Contributing
Contributions are welcome! Please fork the repository and create a pull request.

License
This project is licensed under the MIT License - see the LICENSE file for details.

Popular repositories Loading

  1. fanyty fanyty Public

    这是我关于自动化测试和性能测试学习过程中的一些笔记和记录。希望能帮助到有需要的人,并欢迎一起交流和讨论。

    HTML 4

  2. toBeBetterJavaer toBeBetterJavaer Public

    Forked from itwanger/toBeBetterJavaer

    一份通俗易懂、风趣幽默的Java学习指南,内容涵盖Java基础、Java并发编程、Java虚拟机、Java企业级开发、Java面试等核心知识点。学Java,就认准二哥的Java进阶之路😄

  3. grapesjs grapesjs Public

    Forked from GrapesJS/grapesjs

    Free and Open source Web Builder Framework. Next generation tool for building templates without coding

    TypeScript