chromium not working on google colab
Hi, I want to run puppeteer on google colab.
running test code with !node --trace-warnings test.js
says:
Command '/usr/bin/chromium-browser' requires the chromium snap to be installed. Please install it with:snap install chromium
installed chromium with
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!apt install chromium-browser # also gave same result
puppeteer code
const puppeteer = require('puppeteer');
//varv');
const dotenv = require('dotenv');
dotenv.config();
(async () => {
const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser'});
const page = await browser.newPage();
await page.goto('https://www.google.com');
await page.screenshot({
path: 'google.png',
fullPage: true
});
await browser.close();
})();
Tried
I tried installing chromium with 'snap install chromium' it says: error: cannot communicate with server: Post http://localhost/v2/snaps/chromium: dial unix /run/snapd.socket: connect: no such file or directory
Tried installing snapd
!systemctl status snapd.service
# snapd: unrecognized service!sudo apt update && upgrade
!sudo apt install snapd
!which snapd
# error: cannot communicate with server: Post http://localhost/v2/snaps/chromium: dial unix /run/snapd.socket: connect: no such file or directory
Tried brave-browser
- installation code: https://brave.com/linux/
- executablePath:
"/opt/brave.com/brave"
- error:
(node:42514) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! spawn /opt/brave.com/brave EACCES
chmod +x /opt/brave.com/brave
# did not solve
Tried google-chrome: Worked while creating this question
- installation code: https://brave.com/linux/
- executablePath:
"/opt/google/chrome/chrome"
references:
https://colab.research.google.com/drive/168X6Zo0Yk2fzEJ7WDfY9Q_0UOEmHSrZc?usp=sharing#scrollTo=_Yf4OfPBAAPR
https://forum.snapcraft.io/t/snap-d-error-cannot-communicate-with-server-connection-refused/6093/23