{"id":25044889,"url":"https://github.com/thiagojacinto/selenium-with-python-getstarted","last_synced_at":"2025-08-13T05:14:31.409Z","repository":{"id":208539293,"uuid":"706983946","full_name":"thiagojacinto/selenium-with-python-getstarted","owner":"thiagojacinto","description":"Automated tests using Python flavor of the Selenium framework","archived":false,"fork":false,"pushed_at":"2023-12-12T01:51:25.000Z","size":231,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T06:56:13.456Z","etag":null,"topics":["pytest","selenium-python","test-automation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thiagojacinto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-19T01:53:21.000Z","updated_at":"2023-12-05T20:20:57.000Z","dependencies_parsed_at":"2023-11-30T02:27:01.433Z","dependency_job_id":"a2badbea-b613-4a87-8fac-e594e0f22760","html_url":"https://github.com/thiagojacinto/selenium-with-python-getstarted","commit_stats":null,"previous_names":["thiagojacinto/selenium-with-python-getstarted"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/thiagojacinto/selenium-with-python-getstarted","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagojacinto%2Fselenium-with-python-getstarted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagojacinto%2Fselenium-with-python-getstarted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagojacinto%2Fselenium-with-python-getstarted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagojacinto%2Fselenium-with-python-getstarted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagojacinto","download_url":"https://codeload.github.com/thiagojacinto/selenium-with-python-getstarted/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagojacinto%2Fselenium-with-python-getstarted/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270183606,"owners_count":24541341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytest","selenium-python","test-automation"],"created_at":"2025-02-06T05:19:43.578Z","updated_at":"2025-08-13T05:14:31.390Z","avatar_url":"https://github.com/thiagojacinto.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Get started: Selenium + pytest\n\nAutomated tests using Python flavor of the Selenium framework.\n\n- [Get started: Selenium + pytest](#get-started-selenium--pytest)\n- [How to install](#how-to-install)\n  - [Initial setup](#initial-setup)\n  - [Configure dependecies](#configure-dependecies)\n- [How to execute tests](#how-to-execute-tests)\n  - [Expected output of test run](#expected-output-of-test-run)\n  - [Selecting a specific browser](#selecting-a-specific-browser)\n  - [Set a default browser to run a specific test](#set-a-default-browser-to-run-a-specific-test)\n  - [Using `pytest` parametrize option to repeat test on different browsers](#using-pytest-parametrize-option-to-repeat-test-on-different-browsers)\n  - [Using containers to run tests](#using-containers-to-run-tests)\n    - [Custom environment variables](#custom-environment-variables)\n\n\n# How to install\n\n## Initial setup\n\nFirst things first: This is a Python project. So you need to make sure to have Python installed.\n\n```shell\n# Verify your local python version installed:\npython3 --version\n```\n\n\u003e The recommended version is `Python 3.11.2`. Follow the [official docs](https://www.python.org/downloads/) to install it, if you need.\n\nThis project also recommends the use of ***virtual environment*** to handle the dependency isolation. Feel free to [read the official documentation](https://docs.python.org/3/library/venv.html#creating-virtual-environments) for more information about it.\n\n## Configure dependecies\n\nUse the following steps to configure this project of Test Automation:\n\n```shell\n# clone this project from GitHub\ngit clone git@github.com:thiagojacinto/selenium-with-python-getstarted.git\n\n# chage to your brand new local repository directory\ncd selenium-with-python-getstarted\n\n# create a Python virtual enviroment and activate it (UNIX compatible)\npython3 -m venv .venv \\\n    \u0026\u0026 source .venv/bin/activate\n\n# install the dependencies from the lock, that guarantee the same dependencies verisons:\npip install -r requirements-lock.txt\n```\n\n# How to execute tests\n\nOnce configured, to execute the tests, go to the project directory then type:\n\n```bash\npytest\n\n# You can use pytest -vv for a more verbose test output\n```\n\n## Expected output of test run\n\nAn output like this is expected after the tests are all run:\n\n![](evidencies/EXECUTION-OUTPUT_2023-12-04_22.22.34.png)\n\n## Selecting a specific browser\n\nYou may want to use a specific browser to run the tests, therefore use the following argument to achieve this:\n\n```bash\npytest --use-browser firefox\n```\n\nThe supported browser options list is [described here](https://github.com/thiagojacinto/selenium-with-python-getstarted/blob/3329a51fa38d473f2519c0caf01c3a63e30cbba2/conftest.py#L5C28-L5C28). And with `pytest -h`, you can find more about this option:\n```\nCustom options:\n  --use-browser=USE_BROWSER\n        Define the browser to be executed. Current supported versions: chrome, firefox, safari, headless-chrome, headless-firefox, headless-safari\n```\n\n## Set a default browser to run a specific test\n\nYou can also set a default browser to run the tests by using a custom Pytest's Mark, as the exemple below:\n\n```python\n@pytest.mark.FORCE_BROWSER(\"firefox\")\ndef test_successfully_run_with_firefox(...):\n  ...\n```\n\nThe test above will be run using the Firefox browser and this mark takes precedence over the CLI argument `--use-browser`, if it is passed.\n\n## Using `pytest` parametrize option to repeat test on different browsers\n\nIt's useful to use the powers of `pytest` framework to handle situations where the specific test case should be run against a variety of different browsers. A way to make it works it's by using `pytest.mark.parametrize` fixture, as the example below:\n\n```python\n@pytest.mark.parametrize(\n        (\"\"), [\n            pytest.param(id=\"default\"), \n            pytest.param(id=\"edge\", marks=pytest.mark.FORCE_BROWSER(\"edge\")),\n            pytest.param(id=\"chrome\", marks=pytest.mark.FORCE_BROWSER(\"chrome\"))\n            ]\n    )\ndef test_successfully_run_with_edge_chrome_and_default_config(...):\n  ...\n```\nThe way the example above works is by only applying:\n- an _ID_: to be displayed on the pytest output;\n- the custom `FORCE_BROWSER` mark: to force the use of the specified browser. \n\n## Using containers to run tests\n\nTo rapidly set a development environment, using Docker to run containers is a valid alternative. Documentation for `docker-selenium` is set on the [project official repository](https://github.com/SeleniumHQ/docker-selenium) and it might be a good idea to take some time to read it.\n\nThe first steps are condensed on this [Makefile](Makefile), and you could start with the `make help` command to see the basics to: put containers UP or DOWN with Docker, then execute the tests on this infrastructure. All containers configuration are disposed on [compose.yaml](containers/compose.yaml)\n\n```sh\nmake help\n# \u003e These are all the avalaible commands ...\n\nmake se-docker-up # starts the docker containers set by containers/compose.yaml file\n\nmake se-docker-run-tests #Running tests for Firefox, Chrome and Edge browsers from docker containers\n\nmake se-docker-down # terminates the docker containers set by containers/compose.yaml file\n```\n\n### Custom environment variables\n\nThe following environment variables are used to and often necessary, depending on what and how the tests should be executed:\n- `SELENIUM_HOST`: Used to set WHERE to point out the WebDriver's API requests to, when using the `--use-browser` is set to **remote**; (introduced)\n- `SELENIUM_BROWSER`: This one refers to what type of browser will be used on the remote test execution. Important to use on GitHub's action workflow (introduced by [#2](https://github.com/thiagojacinto/selenium-with-python-getstarted/issues/2))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagojacinto%2Fselenium-with-python-getstarted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagojacinto%2Fselenium-with-python-getstarted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagojacinto%2Fselenium-with-python-getstarted/lists"}