1

I have just installed selenium using pip. When I start a django shell I can import modules from selenium. However the following statement fails:

self.browser = webdriver.Firefox()

with the following error:

Traceback (most recent call last):
  File "/opt/my_apps/cpns/core/tests.py", line 771, in setUp
    self.browser = webdriver.Firefox()
  File "/opt/my_apps/cpns/build/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.binary, timeout),
  File "/opt/my_apps/cpns/build/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/opt/my_apps/cpns/build/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 61, in launch_browser
    self._wait_until_connectable()
  File "/opt/my_apps/cpns/build/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable
    self._get_firefox_output())
WebDriverException: Message: "The browser appears to have exited before we could connect. The output was: XPCOMGlueLoad error for file /usr/bin/libxpcom.so:\n/usr/bin/libxpcom.so: cannot open shared object file: No such file or directory\nCouldn't load XPCOM.\n"

The code I'm trying to execute is fairly basic. I copied it online:

class GoogleTestCase(TestCase):

    def setUp(self):
        self.browser = webdriver.Firefox()
        self.addCleanup(self.browser.quit)

    def testPageTitle(self):
        self.browser.get('http://www.google.com')
        self.assertIn('Google', self.browser.title)

I believe it has more to do with firefox installation itself rather than selenium, but in any case any help would be appreciated.

A. B
  • 687
  • 9
  • 18
  • http://stackoverflow.com/questions/13039530/unable-to-call-firefox-from-selenium-in-python-on-aws-machine May be helpful . – Priyank Patel Jan 21 '14 at 04:56
  • Thanks Priyank.. I checked that one, but it is not the same problem I have. I ended up using another installation of firefox and pointing my PATH env variable to it. – A. B Jan 21 '14 at 16:30

1 Answers1

0

Since the problem seemed to do with using a shared object

WebDriverException: Message: "The browser appears to have exited before we could connect. The output was: XPCOMGlueLoad error for file /usr/bin/libxpcom.so:\n/usr/bin/libxpcom.so: cannot open shared object file: No such file or directory\nCouldn't load XPCOM.\n"

I ended up having a new installation of firefox (I noticed that the previous version is too old and I don't have permission to upgrade it), and pointing my PATH variable to use it:

setenv PATH /path/to/new/firefox/:$PATH
A. B
  • 687
  • 9
  • 18