# Selenium for Python
[](https://pypi.org/project/py-selenium-auto/)
[](https://pypi.org/project/py-selenium-auto/)
[](https://pypi.org/project/py-selenium-auto/)
[](https://github.com/Polmik/py-selenium-auto/actions/workflows/tests.yml)
[](https://codecov.io/gh/Polmik/py-selenium-auto)
[](https://pypi.org/project/py-selenium-auto/)
[](https://github.com/psf/black)
### Introduction
This package is a library designed to simplify your work with Selenium WebDriver and based on [py-selenium-auto-core](https://github.com/Polmik/py-selenium-auto-core) solution.
### Supported browsers
* Chrome
**Note: Support for popular browsers will be expanded in the future**
### Supported Python Versions
* Python 3.7-3.12
### Installation
If you have [pip](https://pip.pypa.io/en/stable/) on your system, you can simply install or upgrade the Python bindings:
```bash
pip install -U py-selenium-auto
```
Alternately, you can download the source distribution from [PyPI](https://pypi.org/project/py-selenium-auto/#files), unarchive it, and run:
```bash
python setup.py install
```
### Template
To start the project using this solution, you can look into [py-selenium-auto-template
](https://github.com/Polmik/py-selenium-auto-template).
### Quick start
1. Add the dependency in your project
2. Create conftest.py file and add the following code:
```python
@pytest.fixture(scope="session", autouse=True)
def setup_session(request):
# TODO: workaround to set calling root path, because pytest runs from the root dir
work_dir = RootPathHelper.current_root_path(__file__)
os.chdir(work_dir)
```
It's necessary to set root dir for your test directory. It is assumed that your project structure will look like this:
```
src/
__init__.py
some_code/
tests/ # Any name
__init__.py
resources/
some_code/
```
3. Create instance of Browser in your test:
```python
browser = BrowserServices.Instance.browser
```
4. Use Browser's methods directly for general actions, such as navigation, window resize, scrolling and alerts handling:
```python
browser.maximize()
browser.go_to("https://google.com")
browser.wait_for_page_to_load()
```
5. Use ElementFactory class's methods to get an instance of each element:
```python
my_text_box = BrowserServices.Instance.service_provider.element_factory().get_text_box(Locator.by_xpath("XPATH"), "Name")
```
Or you can inherit a class from Form class and use existing ElementFactory:
```python
self.my_text_box = self._element_factory.get_text_box(Locator.by_xpath("XPATH"), "Name")
```
6. Call element's methods to perform action with element:
```python
my_text_box.type("example@email.com")
```
7. Quit browser at the end:
```python
browser.quit()
```
### Configuration
This file is used to configure your browser settings, as well as other settings.By default, your solution will use the file from this project.
Copy the [following file](https://github.com/Polmik/py-selenium-auto/blob/main/py_selenium_auto/resources/settings.json) to your solution in `tests/resources` to configure it yourself
### License
Library's source code is made available under the [Apache 2.0 license](https://github.com/Polmik/py-selenium-auto/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/Polmik/py-selenium-auto",
"name": "py-selenium-auto",
"maintainer": "Egor Ryaboshapko",
"docs_url": null,
"requires_python": null,
"maintainer_email": "mrpolmik@hotmail.com",
"keywords": "testing, selenium, driver, test automation",
"author": "Egor Ryaboshapko",
"author_email": "mrpolmik@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/7d/07/db393290f81e05c0069ad77f21b4288874ce82fef2b5007aefae3d582459/py_selenium_auto-0.4.7.tar.gz",
"platform": "any",
"description": "# Selenium for Python\n\n[](https://pypi.org/project/py-selenium-auto/)\n[](https://pypi.org/project/py-selenium-auto/)\n[](https://pypi.org/project/py-selenium-auto/)\n[](https://github.com/Polmik/py-selenium-auto/actions/workflows/tests.yml)\n[](https://codecov.io/gh/Polmik/py-selenium-auto)\n[](https://pypi.org/project/py-selenium-auto/)\n[](https://github.com/psf/black)\n\n### Introduction\n\nThis package is a library designed to simplify your work with Selenium WebDriver and based on [py-selenium-auto-core](https://github.com/Polmik/py-selenium-auto-core) solution.\n\n### Supported browsers\n* Chrome\n\n**Note: Support for popular browsers will be expanded in the future**\n\n### Supported Python Versions\n\n* Python 3.7-3.12\n\n### Installation \n\nIf you have [pip](https://pip.pypa.io/en/stable/) on your system, you can simply install or upgrade the Python bindings:\n\n```bash\npip install -U py-selenium-auto\n```\n\nAlternately, you can download the source distribution from [PyPI](https://pypi.org/project/py-selenium-auto/#files), unarchive it, and run:\n\n```bash\npython setup.py install\n```\n\n### Template\n\nTo start the project using this solution, you can look into [py-selenium-auto-template\n](https://github.com/Polmik/py-selenium-auto-template).\n\n### Quick start\n\n1. Add the dependency in your project\n2. Create conftest.py file and add the following code:\n```python\n@pytest.fixture(scope=\"session\", autouse=True)\ndef setup_session(request):\n # TODO: workaround to set calling root path, because pytest runs from the root dir\n work_dir = RootPathHelper.current_root_path(__file__)\n os.chdir(work_dir)\n```\n\nIt's necessary to set root dir for your test directory. It is assumed that your project structure will look like this:\n```\nsrc/\n __init__.py\n some_code/\ntests/ # Any name\n __init__.py\n resources/\n some_code/\n```\n3. Create instance of Browser in your test:\n```python\nbrowser = BrowserServices.Instance.browser\n```\n4. Use Browser's methods directly for general actions, such as navigation, window resize, scrolling and alerts handling:\n```python\nbrowser.maximize()\nbrowser.go_to(\"https://google.com\")\nbrowser.wait_for_page_to_load()\n```\n5. Use ElementFactory class's methods to get an instance of each element:\n```python\nmy_text_box = BrowserServices.Instance.service_provider.element_factory().get_text_box(Locator.by_xpath(\"XPATH\"), \"Name\")\n```\nOr you can inherit a class from Form class and use existing ElementFactory:\n```python\nself.my_text_box = self._element_factory.get_text_box(Locator.by_xpath(\"XPATH\"), \"Name\")\n```\n6. Call element's methods to perform action with element:\n```python\nmy_text_box.type(\"example@email.com\")\n```\n7. Quit browser at the end:\n```python\nbrowser.quit()\n```\n\n### Configuration\nThis file is used to configure your browser settings, as well as other settings.By default, your solution will use the file from this project.\n\nCopy the [following file](https://github.com/Polmik/py-selenium-auto/blob/main/py_selenium_auto/resources/settings.json) to your solution in `tests/resources` to configure it yourself\n\n### License\nLibrary's source code is made available under the [Apache 2.0 license](https://github.com/Polmik/py-selenium-auto/blob/main/LICENSE).\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "Selenium for Python",
"version": "0.4.7",
"project_urls": {
"Homepage": "https://github.com/Polmik/py-selenium-auto"
},
"split_keywords": [
"testing",
" selenium",
" driver",
" test automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6c5fb470023a034bae91358413cea262e15f440db2ba28a3bffea54ba054b097",
"md5": "498f7d214544b598c92fabd6df85dd3f",
"sha256": "d5ae881ca458d5a915213d0cc6161cd99c0090087a7bd60ee877dbb6a28850e4"
},
"downloads": -1,
"filename": "py_selenium_auto-0.4.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "498f7d214544b598c92fabd6df85dd3f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 59098,
"upload_time": "2024-09-13T17:34:42",
"upload_time_iso_8601": "2024-09-13T17:34:42.192051Z",
"url": "https://files.pythonhosted.org/packages/6c/5f/b470023a034bae91358413cea262e15f440db2ba28a3bffea54ba054b097/py_selenium_auto-0.4.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d07db393290f81e05c0069ad77f21b4288874ce82fef2b5007aefae3d582459",
"md5": "dbc990ce2bd39fe2147737739dc10d3d",
"sha256": "c228c5e632176a6dfc7ef3d73fd540422fc6c99bc2896722f8229ad8ad05c4fd"
},
"downloads": -1,
"filename": "py_selenium_auto-0.4.7.tar.gz",
"has_sig": false,
"md5_digest": "dbc990ce2bd39fe2147737739dc10d3d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37118,
"upload_time": "2024-09-13T17:34:43",
"upload_time_iso_8601": "2024-09-13T17:34:43.792214Z",
"url": "https://files.pythonhosted.org/packages/7d/07/db393290f81e05c0069ad77f21b4288874ce82fef2b5007aefae3d582459/py_selenium_auto-0.4.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-13 17:34:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Polmik",
"github_project": "py-selenium-auto",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "PyHamcrest",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.4.4"
]
]
},
{
"name": "allure-pytest",
"specs": [
[
"==",
"2.13.5"
]
]
},
{
"name": "selenium",
"specs": [
[
"==",
"4.11.2"
]
]
},
{
"name": "selenium",
"specs": [
[
"==",
"4.24.0"
]
]
},
{
"name": "webdriver-manager",
"specs": [
[
"==",
"4.0.2"
]
]
},
{
"name": "dependency-injector-fork",
"specs": [
[
"==",
"4.42.1"
]
]
},
{
"name": "py-selenium-auto-core",
"specs": [
[
"==",
"0.5.6"
]
]
},
{
"name": "pytest-xdist",
"specs": [
[
"==",
"3.5.0"
]
]
}
],
"lcname": "py-selenium-auto"
}