{"id":15792898,"url":"https://github.com/jinmoo21/pwdriver","last_synced_at":"2025-07-19T22:37:15.981Z","repository":{"id":42454816,"uuid":"304046799","full_name":"jinmoo21/PWDriver","owner":"jinmoo21","description":"To simplify web browser automation settings for python.","archived":false,"fork":false,"pushed_at":"2023-09-24T14:22:35.000Z","size":122,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T23:20:13.970Z","etag":null,"topics":["appium","appium-webdriver","automation","python","selenium","selenium-webdriver","test-automation","testing","webdriver"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pwdriver/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jinmoo21.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}},"created_at":"2020-10-14T14:49:40.000Z","updated_at":"2023-04-01T13:44:16.000Z","dependencies_parsed_at":"2023-09-24T17:34:25.742Z","dependency_job_id":null,"html_url":"https://github.com/jinmoo21/PWDriver","commit_stats":{"total_commits":145,"total_committers":3,"mean_commits":"48.333333333333336","dds":0.06206896551724139,"last_synced_commit":"712d711c6d4b41c43a5dd98423baf76743ce6269"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinmoo21%2FPWDriver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinmoo21%2FPWDriver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinmoo21%2FPWDriver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinmoo21%2FPWDriver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jinmoo21","download_url":"https://codeload.github.com/jinmoo21/PWDriver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593225,"owners_count":20316152,"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","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":["appium","appium-webdriver","automation","python","selenium","selenium-webdriver","test-automation","testing","webdriver"],"created_at":"2024-10-04T23:06:43.323Z","updated_at":"2025-03-14T14:30:45.528Z","avatar_url":"https://github.com/jinmoo21.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PWDriver (PyWebDriver)\n\n[![E2e test](https://github.com/jinmoo21/pwdriver/actions/workflows/python_test.yml/badge.svg)](https://github.com/jinmoo21/pwdriver/actions/workflows/python_test.yml)\n[![Code Coverage](https://codecov.io/gh/jinmoo21/pwdriver/branch/master/graph/badge.svg?branch=master\u0026kill_cache=1)](https://codecov.io/gh/jinmoo21/pwdriver)\n\n[![Release status](https://github.com/jinmoo21/pwdriver/actions/workflows/python_release.yml/badge.svg)](https://github.com/jinmoo21/pwdriver/actions/workflows/python_release.yml)\n[![PyPI version](https://badge.fury.io/py/pwdriver.svg)](https://badge.fury.io/py/pwdriver)\n\n[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/jinmoo21/PWDriver/blob/master/LICENSE)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fjinmoo21%2FPWDriver.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fjinmoo21%2FPWDriver?ref=badge_shield)\n\n## Motivation\n\nTo simplify automation settings of each different platform, version, browser. \n\n##### Support:\n\n- ChromeDriver\n\n- GeckoDriver\n\n- EdgeDriver (Chromium)\n\n- ~~IEDriver~~\n\n- ...and Android, iOS (See [With Appium](https://github.com/jinmoo21/PWDriver#with-appium) section)\n\n## Usage\n\n### 1. Install:\n\n```bash\npip install pwdriver\n```\n\n### 2. Make 'config.ini' file and locate in your project directory.\n\n`config.ini` look like this.\n\n```ini\n[automation]\n;if using remote webdriver, then local be false and url required.\nlocal=true\nurl=http://localhost:4444\n;target: chrome, gecko, edge, safari\ntarget=chrome\n```\n\n### 3. Import WebDriverFactory.\n\nNow, we can launch webdriver.   \n\n```python\nfrom pwdriver.core import WebDriverFactory\n\ndriver = WebDriverFactory.launch()\n```\n\n## Alternative Usage\n\nThis way doesn't make and doesn't use configuration file, but calls setup method of the driver in your test code.\n\n### with Chrome:\n\n```python\nfrom selenium import webdriver\nfrom pwdriver import core\n\ncore.setup_chromedriver()\ndriver = webdriver.Chrome()\n```\n\n### with FireFox:\n\n```python\nfrom selenium import webdriver\nfrom pwdriver import core\n\ncore.setup_geckodriver()\ndriver = webdriver.Firefox()\n```\n\n### with Edge:\n\n```python\nfrom selenium import webdriver\nfrom pwdriver import core\n\ncore.setup_edgedriver()\ndriver = webdriver.Edge()\n```\n\n## Page object models\n\nPage object models pattern makes our test cases more concise and readable.\n\nThe good news is, we can use Page Objects with this.\n\nThere is an example that searching for keyword on `www.bing.com` and verifying url, title.\n\nFor using this, we are going to create modules that page object classes and test cases.\n\nModules that page elements and locators already implemented, so nevermind.\n\n\n### Page Object Class\n\n```python\nfrom selenium.webdriver.common.by import By\n\nfrom pwdriver.page import BasePage\n\n\nclass BingPage(BasePage):\n    def __init__(self, driver):\n        super().__init__(driver)\n        self._url = 'https://www.bing.com'\n        self._locator = {\n            'input': (By.CSS_SELECTOR, 'input#sb_form_q'),\n            'search': (By.CSS_SELECTOR, 'label#search_icon')\n        }\n\n    def type_keyword(self, text) -\u003e None:\n        self._by('input').send_keys(text)\n\n    def click_search(self) -\u003e BasePage:\n        self._by('search').click()\n        return BingPage(BasePage)\n```\n\n### Test case\n\n```python\nfrom pwdriver.core import WebDriverFactory\nfrom tests.pages.bing_page import BingPage\n\nimport unittest\n\n\nclass BrowserTest(unittest.TestCase):\n    def setUp(self):\n        self.driver = WebDriverFactory.launch()\n\n    def tearDown(self):\n        self.driver.quit()\n\n    def test_something(self):\n        page = BingPage(self.driver)\n        page.get()\n        keyword = 'chicken'\n        page.type_keyword(keyword)\n        page.submit_keyword()\n        self.assertIn(f'https://www.bing.com/search?q={keyword}', self.driver.current_url)\n        self.assertEqual(f'{keyword} - Search', self.driver.title)\n\n\nif __name__ == '__main__':\n    unittest.main()\n```\n\n## Logging and Event listener\n\nIf we want to use logging or want to see what events occured in webdriver,\n\nwe can use `get_logger()` or `EventListener()`.\n\nSee below example code.\n\n### Test\n\n```python\nfrom selenium.webdriver.support.events import EventFiringWebDriver\n\nfrom pwdriver.core import WebDriverFactory\nfrom pwdriver.listener import EventListener\nfrom pwdriver.util import get_logger\n\nlogger = get_logger('test')\n\ncore = WebDriverFactory.launch()\ndriver = EventFiringWebDriver(core, EventListener())\nlogger.info('WebDriver created.')\n```\n\n* Log level: `debug`, `info`, `warning`, `error`, `critical`\n* WebDriver event: `navigate`, `execute script`\n* WebElement event: `find`, `click`, `change value` \n\n## With Appium\n\nThis package also includes wrapped appium's remote webdriver.\n\nWe could launch an appium driver using `config.ini` file that contains capabilities.\n\nSee below configuration and example code.\n\n### Configuration\n\n```ini\n[automation]\n;if using appium, then local be false and url required.\nlocal=false\nurl=http://localhost:4723\n;target: android, ios\ntarget=ios\n\n[mobile]\n;add capabilities for mobile testing.\nplatformVersion=15.5\ndeviceName=iPhone 13 mini\nbrowserName=Safari\n```\n\n### Test\n\n```python\nfrom pwdriver.core import WebDriverFactory\n\ndriver = WebDriverFactory.launch()\n```\n\n\n## License\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fjinmoo21%2FPWDriver.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fjinmoo21%2FPWDriver?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinmoo21%2Fpwdriver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjinmoo21%2Fpwdriver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinmoo21%2Fpwdriver/lists"}