# lambdatest-playwright-driver
[![SmartUI-Testing](https://smartui.lambdatest.com/static/media/LTBadge.64a05e73.svg)](https://smartui.lambdatest.com)
SmartUI SDK for python playwright
- [Installation](#installation)
- [Methods](#methods)
- [Usage](#usage)
## Installation
Install Smart UI cli
```sh-session
$ npm install -g @lambdatest/smartui-cli
```
Install Python Playwright Package
```sh-session
$ pip3 install lambdatest-playwright-driver
```
## Methods
``` python
smartui_snapshot(page,"snapshotName")
```
- `page` (**required**) - A page object instance from playwright is required.
- `snapshotName` (**required**) - Name of the screenshot
## Usage
Example playwright test using `smartui_snapshot`
``` python
from playwright.sync_api import sync_playwright, Playwright
from lambdatest_playwright_driver import smartui_snapshot
def run(playwright: Playwright):
webkit = playwright.webkit
browser = webkit.launch()
context = browser.new_context()
page = context.new_page()
try:
page.goto("https://www.lambdatest.com")
smartui_snapshot(page, "example_snapshot", options={})
except Exception as e:
print(f"Error occurred during SmartUI snapshot: {e}")
finally:
browser.close()
with sync_playwright() as playwright:
run(playwright)
```
Copy the project token from [SmartUI Dashboard](https://smartui.lambdatest.com/) and set on CLI via comman
<b>For Linux/macOS:</b>
```sh-session
export PROJECT_TOKEN="****-****-****-************"
```
<b>For Windows:</b>
```sh-session
set PROJECT_TOKEN="****-****-****-************"
```
Running test
```sh-session
$ npx smartui exec [python test command]
```
This will create new build and upload snapshot to Smart UI Project.
Executing above test
```sh-session
$ npx smartui exec python test.py
✔ Authenticated with SmartUI
→ using project token '******#ihcjks'
✔ SmartUI started
→ listening on port 8080
✔ Fetched git information
→ branch: main, commit: 7e336e6, author: Sushobhit Dua
✔ SmartUI build created
→ build id: ee2cb6c5-9541-494a-9c75-a74629396b80
✔ Execution of 'python3 test.py' completed; exited with code 0
→ INFO:@lambdatest/python-selenium-driver:Snapshot captured name
✔ Finalized build
```
## Contribute
#### Reporting bugs
Our GitHub Issue Tracker will help you log bug reports.
Tips for submitting an issue:
Keep in mind, you don't end up submitting two issues with the same information. Make sure you add a unique input in every issue that you submit. You could also provide a "+1" value in the comments.
Always provide the steps to reproduce before you submit a bug.
Provide the environment details where you received the issue i.e. Browser Name, Browser Version, Operating System, Screen Resolution and more.
Describe the situation that led to your encounter with bug.
Describe the expected output, and the actual output precisely.
#### Pull Requests
We don't want to pull breaks in case you want to customize your LambdaTest experience. Before you proceed with implementing pull requests, keep in mind the following.
Make sure you stick to coding conventions.
Once you include tests, ensure that they all pass.
Make sure to clean up your Git history, prior your submission of a pull-request. You can do so by using the interactive rebase command for committing and squashing, simultaneously with minor changes + fixes into the corresponding commits.
## About LambdaTest
[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.
Raw data
{
"_id": null,
"home_page": "https://github.com/LambdaTest/lambdatest-python-sdk",
"name": "lambdatest-playwright-driver",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "lambdatest python playwright sdk visual testing",
"author": "LambdaTest <keys@lambdatest.com>",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/8f/66/cd73defa9846c730390d1b207601266aa4e8a04ec01e75d580d17c81a019/lambdatest_playwright_driver-1.0.0.tar.gz",
"platform": null,
"description": "# lambdatest-playwright-driver\n[![SmartUI-Testing](https://smartui.lambdatest.com/static/media/LTBadge.64a05e73.svg)](https://smartui.lambdatest.com)\n\nSmartUI SDK for python playwright\n- [Installation](#installation)\n- [Methods](#methods)\n- [Usage](#usage)\n\n## Installation\n\nInstall Smart UI cli\n\n```sh-session\n$ npm install -g @lambdatest/smartui-cli \n```\n\nInstall Python Playwright Package\n\n```sh-session\n$ pip3 install lambdatest-playwright-driver\n```\n\n## Methods\n``` python\nsmartui_snapshot(page,\"snapshotName\")\n```\n\n- `page` (**required**) - A page object instance from playwright is required.\n- `snapshotName` (**required**) - Name of the screenshot\n\n## Usage\n\nExample playwright test using `smartui_snapshot`\n\n``` python\nfrom playwright.sync_api import sync_playwright, Playwright\nfrom lambdatest_playwright_driver import smartui_snapshot\n\ndef run(playwright: Playwright):\n webkit = playwright.webkit\n browser = webkit.launch()\n context = browser.new_context()\n page = context.new_page()\n \n try:\n page.goto(\"https://www.lambdatest.com\")\n smartui_snapshot(page, \"example_snapshot\", options={})\n except Exception as e:\n print(f\"Error occurred during SmartUI snapshot: {e}\")\n finally:\n browser.close()\n\nwith sync_playwright() as playwright:\n run(playwright)\n```\n\n\nCopy the project token from [SmartUI Dashboard](https://smartui.lambdatest.com/) and set on CLI via comman\n<b>For Linux/macOS:</b>\n\n```sh-session\n export PROJECT_TOKEN=\"****-****-****-************\"\n```\n\n<b>For Windows:</b>\n\n```sh-session\n set PROJECT_TOKEN=\"****-****-****-************\"\n```\n\nRunning test\n```sh-session\n$ npx smartui exec [python test command]\n```\nThis will create new build and upload snapshot to Smart UI Project.\n\nExecuting above test\n\n```sh-session\n$ npx smartui exec python test.py\n\u2714 Authenticated with SmartUI\n \u2192 using project token '******#ihcjks'\n\u2714 SmartUI started\n \u2192 listening on port 8080\n\u2714 Fetched git information\n \u2192 branch: main, commit: 7e336e6, author: Sushobhit Dua\n\u2714 SmartUI build created\n \u2192 build id: ee2cb6c5-9541-494a-9c75-a74629396b80\n\u2714 Execution of 'python3 test.py' completed; exited with code 0\n \u2192 INFO:@lambdatest/python-selenium-driver:Snapshot captured name\n\u2714 Finalized build\n\n```\n\n## Contribute\n\n#### Reporting bugs\n\nOur GitHub Issue Tracker will help you log bug reports.\n\nTips for submitting an issue:\nKeep in mind, you don't end up submitting two issues with the same information. Make sure you add a unique input in every issue that you submit. You could also provide a \"+1\" value in the comments.\n\nAlways provide the steps to reproduce before you submit a bug.\nProvide the environment details where you received the issue i.e. Browser Name, Browser Version, Operating System, Screen Resolution and more.\nDescribe the situation that led to your encounter with bug.\nDescribe the expected output, and the actual output precisely.\n\n#### Pull Requests\n\nWe don't want to pull breaks in case you want to customize your LambdaTest experience. Before you proceed with implementing pull requests, keep in mind the following.\nMake sure you stick to coding conventions.\nOnce you include tests, ensure that they all pass.\nMake sure to clean up your Git history, prior your submission of a pull-request. You can do so by using the interactive rebase command for committing and squashing, simultaneously with minor changes + fixes into the corresponding commits.\n\n## About LambdaTest\n\n[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python Playwright SDK for visual testing with Smart UI",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/LambdaTest/lambdatest-python-sdk"
},
"split_keywords": [
"lambdatest",
"python",
"playwright",
"sdk",
"visual",
"testing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e2345604c0064497464b5f963a0719725b96a3980f3cbe66e1d1d0509b0470b",
"md5": "48fc0e56b7e235d3863bdeaf8038d5e8",
"sha256": "31f90fd27c57b05c74763d7a9fa08bca38e3fc906c0bc2533fe4507a424b7d86"
},
"downloads": -1,
"filename": "lambdatest_playwright_driver-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "48fc0e56b7e235d3863bdeaf8038d5e8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4599,
"upload_time": "2024-05-20T14:49:33",
"upload_time_iso_8601": "2024-05-20T14:49:33.547671Z",
"url": "https://files.pythonhosted.org/packages/1e/23/45604c0064497464b5f963a0719725b96a3980f3cbe66e1d1d0509b0470b/lambdatest_playwright_driver-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f66cd73defa9846c730390d1b207601266aa4e8a04ec01e75d580d17c81a019",
"md5": "b622cd3984427ac11c17c9d48f1ad983",
"sha256": "dfa58f657c0afc89fca612e0cac171f89aac85b12d0367ff3dcfff5a675dd975"
},
"downloads": -1,
"filename": "lambdatest_playwright_driver-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "b622cd3984427ac11c17c9d48f1ad983",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4049,
"upload_time": "2024-05-20T14:49:34",
"upload_time_iso_8601": "2024-05-20T14:49:34.731978Z",
"url": "https://files.pythonhosted.org/packages/8f/66/cd73defa9846c730390d1b207601266aa4e8a04ec01e75d580d17c81a019/lambdatest_playwright_driver-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-20 14:49:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LambdaTest",
"github_project": "lambdatest-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "lambdatest-playwright-driver"
}