https://github.com/andrew-costure/testing-with-selenium
https://github.com/andrew-costure/testing-with-selenium
javascript python selenium testing
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/andrew-costure/testing-with-selenium
- Owner: Andrew-Costure
- Created: 2025-02-01T08:49:28.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-08T18:46:03.000Z (2 months ago)
- Last Synced: 2025-04-14T14:15:48.413Z (28 days ago)
- Topics: javascript, python, selenium, testing
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 23
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Testing with Selenium
## Introduction
This project demonstrates automated testing using Selenium WebDriver. It includes test scripts for web applications to ensure functionality, performance, and usability.## Features
- Automated UI testing using Selenium
- Support for multiple browsers (Chrome, Firefox, Edge)
- Integration with pytest for test execution
- Data-driven testing using CSV or JSON files
- Headless browser testing support
- Logging and reporting using Allure## Prerequisites
- Python 3.x installed
- Browser drivers installed (ChromeDriver, GeckoDriver, etc.)
- Required Python packages installed## Installation
Clone the repository and install dependencies:```sh
# Clone the repository
git clone https://github.com/your-username/testing-with-selenium.git
cd testing-with-selenium# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`# Install dependencies
pip install -r requirements.txt
```## Configuration
Ensure that the appropriate web driver is placed in the system PATH or specify its location in the script.## Running Tests
Execute tests using pytest:```sh
pytest tests/
```Run tests with detailed output:
```sh
pytest -v --html=report.html --self-contained-html
```Run tests in headless mode:
```sh
pytest --headless
```## Writing Your Own Tests
1. Create a new test file in the `tests/` folder.
2. Import `pytest` and `selenium`.
3. Write test functions using `pytest` format.
4. Use `setup` and `teardown` methods for driver initialization.Example:
```python
import pytest
from selenium import webdriverdef test_google_search():
driver = webdriver.Chrome()
driver.get("https://www.google.com")
assert "Google" in driver.title
driver.quit()
```## Reporting
Generate an HTML report:```sh
pytest --html=report.html
```