Skip to content

Latest commit

 

History

History
60 lines (50 loc) · 2.88 KB

README.md

File metadata and controls

60 lines (50 loc) · 2.88 KB

Selenium examples in Python

Playing with the Selenium web application testing framework. The configuration file for the test methods describes the inputs for them as key-value pairs, with the expected outputs as well.

Motivation

A few Selenium examples are demonstrated for Software Testing master course. The aim of the project is to try out Selenium capabilities on a web page which was specifically developed for this purpose: http://the-internet.herokuapp.com/

Installation

Install Anaconda from the official page. Clone the project. Open an Anaconda terminal and create a new virtual environment:

conda create -n SeleniumTesting python=3.8 anaconda
conda activate SeleniumTesting
pip install selenium

Usage example

pytest test_selenium.py -ssv --cov

Or

python -m unittest test_selenium.py

Project Organization

├── README.md                       <- The top-level README for people who want to use this project.
├── config
│   ├── test_config.yaml            <- Defines the inputs and outputs for the test methods.
├── chrome_driver
│   ├── chrome_driver.exe           <- Driver of Chrome browser to run the tests.
├── data_test
│   ├── file_upload_test.txt        <- A file with some content to test file upload.  
├── cookie.py                       <- Page object to manipulate cookies.
├── drag_and_drop.py                <- Page object to test drag and drop.
├── drag_and_dropy_javascript.py    <- Javascript defined in a Python string to test drag and drop.
├── page_base.py                    <- Page object to manipulate cookies.
├── page_dropdown.py                <- Page object to test dropdown feature.
├── page_file_upload.py             <- Page object to test file uploading.
├── page_hover.py                   <- Page object to test hover feature.
├── page_log_in.py                  <- Page object to test log in feature.
├── page_main.py                    <- Page object for the main page.
├── page_secure_download.py         <- Page object to manipulate cookies.
├── page_sign_in.py                 <- Page object to test sign in feature.
├── test_selenium.py                <- Unit testing methods.
├── utilities.py                    <- Utility functions.

Useful resources

Selenium documentation for multiple languages
Selenium documentation for Python
Page Object Pattern
16 Selenium Best Practices