Playwright Scraper avatar

Playwright Scraper

Try for free

No credit card required

Go to Store
Playwright Scraper

Playwright Scraper

apify/playwright-scraper
Try for free

No credit card required

Crawls websites with the headless Chromium, Chrome, or Firefox browser and Playwright library using a provided server-side Node.js code. Supports both recursive crawling and a list of URLs. Supports login to a website.

Do you want to learn more about this Actor?

Get a demo
CG

I can't seem to understand what is wrong with the code.

Closed

Cameryn_Gardner opened this issue
7 months ago

I have tried to correct the errors but can't understand what is wrong with the code...

jindrich.bar avatar

Hello and thank you for your interest in this Actor!

There are two issues with the Actor setup you're using. The one the Actor is complaining about - the preNavigationHooks are supposed to be an array of function "literals", not an array of stringified functions - see the screenshot attached below.

The other problem is that when preNavigationHooks are running, the page is in a "before-navigation" state - nothing is loaded yet. If you want to log in to the website, you have to move your logic to the postNavigationHooks. I also found out that the waitForNavigation call in the login function causes the actor to hang indefinitely, so I just removed it - but maybe I just didn't understand its importance.

I'll close this issue now, but feel free to ask any additional questions, if you have any. Cheers!

CG

Cameryn_Gardner

7 months ago

Thanks Jindřich for getting back to me.

I have applied the changes you suggested, but I am still having issues with the pre navigation hooks.

Please can I ask you to have a look at the log, here is the URL: https://console.apify.com/actors/MpRbnNmVAoj5RC1Ma/runs/j2unTmsHqS86FOzlr#log

Thank you for all your help.

Regards;

--

[image: Logo] https://www.battlebearmarketing.com/ Cameryn Gardner | CEO *a: *Battle Bear | Smith Rd | Bedfordview 2008 e: Cameryn@battlebearmarketing.com w: www.battlebearmarketing.com http://www.battlebearmarketing.com/ m: +27 68 297 6951 | p: +27 10 495 4914 [image: facebook icon] https://business.facebook.com/BattleBearMarketing/ [image: instagram icon] https://www.instagram.com/battle_bear_marketing/

Developer
Maintained by Apify

Actor Metrics

  • 67 monthly users

  • 18 stars

  • >99% runs succeeded

  • 54 days response time

  • Created in Aug 2022

  • Modified 6 months ago

Categories