deep-jade
deep-jade2y ago

How to use Playwright locator assertions in Crawlee?

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
Page | Playwright
* extends: [EventEmitter]
3 Replies
deep-jade
deep-jadeOP2y ago
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
HonzaS
HonzaS2y ago
no sure if it is recommended but I have done it and it works really well
deep-jade
deep-jadeOP2y ago
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!

Did you find this page helpful?