A plugin to run pyppeteer in pytest.
Project description
pytest-pyppeteer
A plugin to run pyppeteer in pytest.
Document
https://pytest-pyppeteer.readthedocs.io/
Installation
You can install pytest-pyppeteer via pip:
$ pip install pytest-pyppeteer
or install the latest one on Github:
pip install git+https://github.com/luizyao/pytest-pyppeteer.git
Quickstart
For example, query the rating of the movie The Shawshank Redemption on douban.com.
from dataclasses import dataclass
@dataclass
class Elements:
url = "https://movie.douban.com/"
query = "#inp-query"
apply = ".inp-btn > input:nth-child(1)"
result = (
"#root > div > div > div > div > div:nth-child(1) > div.item-root a.cover-link"
)
rating = (
"#interest_sectl > div.rating_wrap.clearbox > div.rating_self.clearfix > strong"
)
async def test_options_mark(pyppeteer):
page = await pyppeteer.new_page()
await page.goto("https://movie.douban.com")
await page.type(Elements.query, "The Shawshank Redemption")
await page.click(Elements.apply)
await page.waitfor(Elements.result)
await page.click(Elements.result)
await page.waitfor(Elements.rating)
rating = await page.get_value(Elements.rating)
assert rating == 0
License
Distributed under the terms of the MIT license, pytest-pyppeteer is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest-pyppeteer-0.2.0.tar.gz.
File metadata
- Download URL: pytest-pyppeteer-0.2.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acab0739dadbaa5e4857a17df3c580b54a3878eae078f84db5779badc73ab3f7
|
|
| MD5 |
65ba68c7bd01dedbc3f68f5af2b9b9da
|
|
| BLAKE2b-256 |
3eb9b484ae65b1e4a8345bc272d781e886939936718e66f9383828eef36d5f7f
|
File details
Details for the file pytest_pyppeteer-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pytest_pyppeteer-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
647b24c741c71bd91ed9c85ae936028130ac63f3b0fabe6c0c4c5f1c070087a8
|
|
| MD5 |
ec3a336b0fd7d7f6a25794262fa208e2
|
|
| BLAKE2b-256 |
459b29bb29d868c5dd98468bc85bba27f65c9e28331bc921fd42edfda39f2313
|