Apify Discord Mirror

Updated 5 months ago

How to use Playwright locator assertions in Crawlee?

At a glance

The community member is asking about using expect assertions for element location in Playwright, as they were able to do in Selenium. The comments suggest that installing the playwright/test package may help, but the community members are unsure if this is recommended. Overall, the community members confirm that the expect assertions are useful and recommended by the Playwright documentation.

Useful resources
In Selenium, we can check for element visibility by either using a WebDriverWait or just manually checking for the element, and in playwright this is done through expect assertions, while we can wait for an element using waitForSelector and using an appropriate timeout, i couldn't find a way to use expect location assertions inside the crawler.

Is there a way I can use them?

ref: https://playwright.dev/docs/api/class-page#page-get-by-title
A
H
3 comments
we can install the platywright/test package to get it working since crawlee is version agnostic for playwright but not sure if its recommended though
no sure if it is recommended but I have done it and it works really well
yeah those assertions are really clean to make sure what you are scraping is right and even the playwright docs recommend them. Thanks for the confirmation though!
Add a reply
Sign up and join the conversation on Discord