#PlaywrightCrawler.requestHandler: Error: mouse.move: Target page, context or browser has been closed

1 messages · Page 1 of 1 (latest)

modest sleet
#

In the PlaywrightCrawler.requestHandler I calling page.mouse.move and
sometimes I get this error: mouse.move: Target page, context or browser has been closed

Here the sequence of calls:

async requestHandler( {request, response, page, enqueueLinks, log, proxyInfo} )
{
    ...
    await sleep( interval );
    await page.mouse.move( rnd(100,400), rnd(40,300) );
    await sleep( interval );
    ...
    content = await page.content();
}

In case I catch the exception thrown in page.mouse.move and contine - than I get
almost the same thing when calling page.content():
page.content: Target page, context or browser has been closed

I would like to move mouse randomly - I think, the make my scraper "human-like".
But something is going wrong here and I can not figure out what.

Sometimes this code works and sometimes I see these errors!
Pls help!

UPDATE:
and sometimes the error message is:
ERROR requestHandler: Request failed and reached maximum retries. page.goto: Navigation failed because page was closed!
I think, somehow these error messages are related...

ionic coral
#

Page might detect bot and close itself, as a quick solution try Playwright (its less detectable)

lucid loom
#

page close usually means it just crashed because your CPU or memory was overloaded. Try to decrease concurrency or increase system resources

modest sleet