CA
rare-sapphire
Can someone tell me what this error means? It says browser closed unexpectedly but not as to why.
13 Replies
passive-yellow•3y ago
Are you running the code on Apify platform? Can you share the run id?
Are you using the beta Python SDK template? There’s no browser in the default Docker image. So even if you install the pyppeteer, the Dockerfile is probably wrong and missing a lot of dependencies....
rare-sapphireOP•3y ago
im using the regular python, not the beta sdk
here's the run id 6VKUYfzm58AaGWni5
passive-yellow•3y ago
Thanks, we are checking it
So yes - my answer above is correct. There's no browser in the image.
rare-sapphireOP•3y ago
what's that mean? i can't use python for browser scraping?
or is there a way to add a browser to the image?
passive-yellow•3y ago
You can, but you will have to take care of browser download and other necessary dependencies. The executable is just not bundled in this image.
rare-sapphireOP•3y ago
the logs show it downloaded chromium i thought. is there something else i have to do for it?
passive-yellow•3y ago
I don't think so - it downloaded pyppeteer, but not the browser executable: https://api.apify.com/v2/logs/ESecEJo1QfYsuhRBe. I haven't personally worked with custom docker images, so I would sadly won't be able to further advance you here, but it's missing the browser and maybe some other deps...
rare-sapphireOP•3y ago
what is this then
passive-yellow•3y ago
It's log from the run, not from the build though - I could guess that it's downloaded during the run, and pyppeteer is not really aware of it/not aware where it's extracted
rare-sapphireOP•3y ago
oh, do you think adding an option that points to it would work?
passive-yellow•3y ago
That might work, but that's still quite weird that in downloads during the run itself. Here's what I got from the team:
rare-sapphireOP•3y ago
ah, that makes sense then. i'll try using actual puppeteer then, although i dont know any js 😅
passive-yellow•3y ago
Depending on the use-case - you could try our generic scrapers - https://apify.com/apify/web-scraper or https://apify.com/apify/playwright-scraper - I'm pretty sure you should pick it up - it does not requires much coding, mainly specifying the selectors, etc
Apify
Web Scraper · Apify
Crawls arbitrary websites using the Chrome browser and extracts data from pages using a provided JavaScript code. The actor supports both recursive crawling and lists of URLs and automatically manages concurrency for maximum performance. This is Apify's basic tool for web crawling and scraping.
Apify
Playwright Scraper · Apify
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.