1

I am trying to figure out how to use the page.waitForFunction() in Playwright in Java.

I would like for a page.evaluate() to run first, and for the page.waitForFunction() to wait on it, before continuing.

I have the following: page.waitForFunction(() => page.evaluate("document.readyState").equals("complete"));

But syntactically that is incorrect or maybe I'm doing something wrong.

adbarads
  • 1,253
  • 2
  • 20
  • 43

1 Answers1

1

You have to pass a string to the waitForFunction

page.waitForFunction("() => page.evaluate('document.readyState').equals('complete')");
hardkoded
  • 18,915
  • 3
  • 52
  • 64