I am trying to run webdriver with geckodriver. I installed selenium gecko, firefox and have python27. My folder has a script and geckodriver.
When I run the python script.py command from centOS, it says
selenium.common.exceptions.WebDriverException: Message: Failed to start browser: permission denied
Below script I use:
#!/usr/bin/env python from pyvirtualdisplay import Display from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary binary = FirefoxBinary('/usr/local/firefox') display = Display(visible=0, size=(800, 600)) display.start() browser = webdriver.Firefox(firefox_binary=binary) browser.get('http://www.google.com') print browser.title browser.quit() display.stop()
before you ask, when I started whereis firefox , I get firefox: /usr/local/bin/firefox /usr/local/firefox
Edit:
After I ran sudo yum -y install firefox Xvfb libXfont Xorg , the python script is running, but I got the geckdriverlog error message:
XPCOMGlueLoad error for file /usr/local/firefox/libxul.so: libdbus-glib-1.so.2: cannot open shared object file: No such file or directory Couldn't load XPCOM.
I think this is due to this error. So I tried sudo yum install libdbus-glib-1-2 , but he said: No package libdbus-glib-1-2 available.
Edit 2:
Therefore, perhaps I should ask (what could be the answer to the question); How can I install lib from here with my libdbus-glib-1-2 terminal installation on CentOS?
Edit 3:
So basically I need Xvfb to run headless firefox, but when I run it Xvfb :19 -screen 0 1024x768x16 & , I'm stuck on the Initializing built-in extension GLX like this question. So I think the problem boils down to how to run silent Firefox on Xvfb.
Finally, I just need to add that with versions of Firefox is just a mess.