Hi, I am having problems getting this to work. More specifically, I can't get chromedriver to work.
Do I have to compile everything from scratch?
Re: Running headless chromium and chromedriver
Hi,
Since the chromedriver is not in the official raspbian repository, you have to get it from here: https://packages.debian.org/stretch/arm ... r/download
Unpack the file "chromedriver" from the archive to /usr/local/bin
Then follow these steps:
sudo chmod +x /usr/local/bin/chromedriver
sudo apt-get install libminizip1
sudo apt-get install libwebpmux2
If you are on Raspbian Stretch Lite (no desktop environment) you also have to install this package:
sudo apt-get install libgtk-3-0
In your code add these two arguments, when you start the driver:
-headless
-disable-gpu
See also my code below, section //Headless?:
Best regards,
chgruem
Since the chromedriver is not in the official raspbian repository, you have to get it from here: https://packages.debian.org/stretch/arm ... r/download
Unpack the file "chromedriver" from the archive to /usr/local/bin
Then follow these steps:
sudo chmod +x /usr/local/bin/chromedriver
sudo apt-get install libminizip1
sudo apt-get install libwebpmux2
If you are on Raspbian Stretch Lite (no desktop environment) you also have to install this package:
sudo apt-get install libgtk-3-0
In your code add these two arguments, when you start the driver:
-headless
-disable-gpu
See also my code below, section //Headless?:
Code: Select all
using System;
using OpenQA.Selenium.Chrome;
namespace WiControlForConnectBox.Selenium
{
public class LibChrome : LibConnectBox
{
public LibChrome (bool HeadlessMode)
{
//Optionen einstellen
var options = new ChromeOptions();
options.AddArgument(@"disable-translate");
options.AddArgument(@"disable-infobars");
//Headless?
if (HeadlessMode)
{
options.AddArgument(@"headless");
options.AddArgument(@"disable-gpu");
options.AddArgument(@"window-size=1024,768");
}
//Treiber starten (chromedriver muss in /usr/local/bin kopiert werden)
var driver = new ChromeDriver(options);
//Timeout festlegen
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
//Treiber eintragen
base.Driver = driver;
}
}
}
chgruem
-
- Posts: 1
- Joined: Tue Feb 20, 2018 11:27 pm
Re: Running headless chromium and chromedriver
@chgruem, Thank you very much for this answer.
I've been searching for a way to set up selenium in my Raspberry for hours.
This was amazing, thank you
I've been searching for a way to set up selenium in my Raspberry for hours.
This was amazing, thank you
-
- Posts: 1
- Joined: Sun Oct 14, 2018 11:27 pm
Re: Running headless chromium and chromedriver
so one thing is that your code seems to be... C#?
using with python Ive been trying to achieve headless scrapping on raspberry pi 3 b+
Ive been following this steps which is unfortunately a closed thread
https://www.reddit.com/r/selenium/comme ... driver_on/
somebody told me i need to put chromium and chromedriver on the same folder??? im actually confused in many aspects
also...
might sound lame but since i did a
sudo mv /usr/lib/chromium-browser/chromedriver /usr/bin/chromedriver
does this mean
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
becomes
driver = webdriver.Chrome('chromedriver')
? OR
driver = webdriver.Chrome()
using with python Ive been trying to achieve headless scrapping on raspberry pi 3 b+
Ive been following this steps which is unfortunately a closed thread
https://www.reddit.com/r/selenium/comme ... driver_on/
somebody told me i need to put chromium and chromedriver on the same folder??? im actually confused in many aspects
also...
might sound lame but since i did a
sudo mv /usr/lib/chromium-browser/chromedriver /usr/bin/chromedriver
does this mean
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver')
becomes
driver = webdriver.Chrome('chromedriver')
? OR
driver = webdriver.Chrome()
Re: Running headless chromium and chromedriver
Apparently the chromium-chromedriver is avaible through apt-get is the only solution that has worked for me. I guess it's easier because the package manager matches the versions [?]... not sure, but it worked.
Re: Running headless chromium and chromedriver
Thanks your solution worked.
Note: 1. Install chromium-chromedriver using apt-get. i.e apt-get install chromium-chromedriver
2. check the path of chromedriver using "whereis chromedriver"
3. Use the path that is fetched in the above step in your code.
Hope it helps to simplify.