This is a sample Selenium Test suite written in Python for the website https://bcacciaaudio.com/
- How to access and test different types of web elements.
- Setting up a class that will allow selection of desired browser for cross-browser testing or execution on Selenium Grid.
- Using the Python
pytestlibrary to create a test suite that avoids code duplication by using fixtures.
pip install seleniumpip install pytestpip install pytest-html
Edit the following fixture in the conftest.py file to only contain the browser(s) you want to test.
The current options are:
chromefirefoxremoteChrome(for Selenium Grid)remoteFirefox(for Selenium Grid)
@pytest.fixture(params=["chrome", "firefox"],scope="class")
Enter the test directory and run:
pytest
To run the tests and generate an HTML report:
pytest --html=NameOfResultsFile.html