More details check with page.py in the source code. Provide an instance with a new method new_page(), like (), new_page() could create a instance.īut the instance created by new_page() has some new methods: Methodįor example, you can query an element by css or xpath in the same method query_locator instead of original querySelector and xpath. query, "The Shawshank Redemption" ) await page. from dataclasses import dataclass ( init = False ) class Elements : """Collect locators of page objects, no matter XPath or CSS Selector.""" # query input query = "#inp-query" # search button apply = ".inp-btn > input:nth-child(1)" # the first result first_result = "#root > div > div > div > div > div:nth-child(1) > div.item-root a.cover-link" # rating rating = "#interest_sectl > div.rating_wrap.clearbox > div.rating_self.clearfix > strong" async def test_lifetimes ( browser ): page = await browser. Or install the latest one on Github: pip install git+įor example, The Shawshank Redemption deserves a 9.0 or higher rating on. You can install pytest-pyppeteer via pip: $ pip install pytest-pyppeteer
0 Comments
Leave a Reply. |