6

I am trying to run a webdriver with geckodriver. I have installed selenium gecko, firefox and have python27. My folder has the script and the geckodriver.

When am running from centOS the command python script.py it says

selenium.common.exceptions.WebDriverException: Message: Failed to start browser: permission denied

Below is the script I am using:

#!/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 run 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 scipt launched but I got an error on the geckdriverlog saying:

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 bug. Therefore I tried sudo yum install libdbus-glib-1-2 but it said, No package libdbus-glib-1-2 available.

Edit 2:

So perhaps I should ask (which might be the answer to the question); How can I ge the lib from here with my terminal install libdbus-glib-1-2 on CentOS?

Edit 3:

So basically to run the headless firefox I need Xvfb but when I run it Xvfb :19 -screen 0 1024x768x16 & I get stuck on Initializing built-in extension GLX like this question. So I think the problem boils down to how to run headless Firefox on Xvfb.

Lastly I just have to add, the thing with the Firefox versions is just a mess.

John James
  • 587
  • 3
  • 8
  • 19

1 Answers1

0

Found other people have same issue, though you tried which, Can you check /usr/local/bin/firefox/firefox workable?

Eric
  • 732
  • 4
  • 13
  • I tried (since I updated a few things, check the question again, it says the error in the edit now) – John James Sep 06 '17 at 13:46
  • What about browser = webdriver.Firefox() instead of any profile. – Eric Sep 06 '17 at 14:10
  • Thats not the issue anymore, cause when I write `firefox` on my terminal I get that `libdbus-glib-1.so.2: cannot open shared object file: No such file or directory Couldn't load XPCOM.` So I think thats they issue now. – John James Sep 06 '17 at 14:13