Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why firefox won't start up under selenium 2 webdriver on redhat 5.6

I was wondering if anyone has any ideas on how I could find out why I can seem to get firefox running through selenium webdriver. What happens is when I run:

self.driver=webdriver.Firefox()

I get a blank dialogue on my desktop. I am running on Redhat 5.6 and my selenium version is 2.21.3. I debugged the code as far as i can go and from what i can determine the code freezes after bringing up the blank dialog on the following code within the firefox_binary module:

Popen([self._start_cmd, "-slient"], stdout=PIPE, stderr=STDOUT, env=self._filefox_env).wait()

I opened up a cmd prompt and manually ran the abovementioned command and no such blank dialog appears. This would make me think that its not a firefox error. I can not find where the error for this would appear. Any ideas?

update

I installed centos 6 and installed firefox 10.0.6 and selenium webdriver worked with that version

update

Aside from using centos 6 I need this problem to also be solved on redhat so here are more details and what I've found. I will put a bounty on this as it needs to be solved:

I dug a little more on this and found that the problem is with selenium using a 32 bit lib. I have selenium version 2.25.0 on Redhat Enterprise Linux Server release 5.6 (x86_64) using Firefox ESR 10.0.6 (64 bit). I changed the _start_from_profile_path method in the firefoxBinary class to see where the problem lies:

p=open("/tmp/ffoutput.txt", "w+")
Popen([self._start_cmd, "-silent"], stdout=p, stderr=STDOUT, env=self._firefox_env).communicate()

and I tailed /tmp/ffoutput.txt I found that selenium is trying to use a 32 bit lib:

Failed to dlopen /usr/lib/libX11.so.6
dlerror says: /usr/lib/libX11.so.6: wrong ELF class: ELFCLASS32

This message occurs continuously and firefox hangs with a blank dialog showing. I googled this problem and found some people complaining but no solutions that worked (I tried softlinking the 64 bit lib to the 32 bit lib dir after moving the 32 bit lib but this caused geko to crash, I tried sending the continuous errors to /dev/null but this solved nothing).

like image 822
amadain Avatar asked May 21 '12 10:05

amadain


1 Answers

If you are referring to this issue reported in Selenium http://code.google.com/p/selenium/issues/detail?id=2852

The work around on 64Bit linux distros is to issue these commands:

sudo mv /usr/lib/libX11.so.6 /usr/lib/libX11.so.6.old
sudo ln -s /usr/lib64/libX11.so.6.3.0 /usr/lib/libX11.so.6

This worked for me on my box.

like image 87
Ashwin Prabhu Avatar answered Jan 03 '23 14:01

Ashwin Prabhu