Unable to open Firefox Binary - webdriver/robot framework

578 views
Skip to first unread message

James

unread,
Nov 22, 2011, 10:21:11 PM11/22/11
to webdriver
Unable to find/open Firefox Binary - webdriver/robot framework


First let me apologize for creating another thread. The first one had
become too unwieldy and I wanted to condense everything down.
My tests run fine in java and fitnesse. They also run fine when
executing them through robot framework with Internet Explorer and
Chrome. However when I execute them through Firefox, using 'new
FirefoxDriver()', I receive the following error:


DEBUG java.lang.ExceptionInInitializerError
at
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:
81)
Caused by: java.lang.NullPointerException
org.openqa.selenium.firefox.FirefoxBinary.<clinit>(FirefoxBinary.java:
42)
... 183 more


In the FirefoxBinary and FirefoxDriver classes these lines correspond
to the following code:


FirefoxBinary ln42-43
private static final String PATH_PREFIX = "/" +
FirefoxBinary.class.getPackage().getName().replace(".", "/") +
"/";

and FirefoxDriver ln 80-82
public FirefoxDriver(FirefoxProfile profile) {
this(new FirefoxBinary(), profile);
}


I have tried setting the path to the Firefox binary in my classpath,
pythonpath (used by robotframework) and path. I have also written the
following lines of code to try to force the binary to be found:

System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\
\Mozilla Firefox\\firefox.exe");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(FirefoxDriver.BINARY, "C:\\Program Files (x86)\
\Mozilla Firefox\\firefox.exe");

I have tried to execute the tests on two computers, my work and home
machines. Further I have tried to use a firefox profile created using
firefox.exe –p and also by creating one in the java code. I have
tried Firefox 6-8. Unfortunately none of these things have worked.

I am also using/have used:
Java 1.6
Selenium 2.9.0/2.13.0
Windows 7


I am unsure if this is related but as a work around I have been trying
to get Firefox to run through a remote browser. I have been trying
the following code:
rcc = new RemoteControlConfiguration();
rcc.setPort(4447);
rcc.setPortDriversShouldContact(4447);
rcc.setInteractive(true);
rcc.setSingleWindow(true);
rcc.setTimeoutInSeconds(30);
ss = new SeleniumServer(rcc);
ss.start();
DesiredCapabilities cap = new DesiredCapabilities();

cap.setJavascriptEnabled(true);
cap.setBrowserName("firefox");
URL url = new URL ("http://www.google.com/");
driver = new RemoteWebDriver(url,cap);

However when I run the above I get the following error message:

Exception in thread "main" org.openqa.selenium.WebDriverException:
Error communicating with the remote browser. It may have died.
Build info: version: '2.13.0', revision: '14794', time: '2011-11-18
17:49:47'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version:
'6.1', java.version: '1.7.0'
Driver info: driver.version: Selenium2Driver
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
412)


Does anyone have any idea on how to fix either of my problems?

Any help would be greatly appreciated, I feel very stuck on this issue
atm. Two days of trying to get Firefox to work when Internet Explorer
already does….. It feels as if the world is about to end.

Thanks,
James

Krishnan Mahadevan

unread,
Nov 22, 2011, 10:30:18 PM11/22/11
to webd...@googlegroups.com
How are you adding up selenium 2.13 to your class path ?

Are you downloading selenium 2.13.0 and adding it up to your lib path or are you using maven dependency ?

This is never going to work for you :


rcc = new RemoteControlConfiguration();
rcc.setPort(4447);
rcc.setPortDriversShouldContact(4447);
rcc.setInteractive(true);
rcc.setSingleWindow(true);
rcc.setTimeoutInSeconds(30);
ss = new SeleniumServer(rcc);
ss.start();
DesiredCapabilities cap = new DesiredCapabilities();

cap.setJavascriptEnabled(true);
cap.setBrowserName("firefox");
URL url = new URL ("http://www.google.com/");
driver = new RemoteWebDriver(url,cap);

RemoteWebDriver is intended to be coupled with an already running Grid and not to be used as how you have mentioned here.

your URL can only be something like this : "http://localhost:44444/wd/hub" (replace localhost with machine name, 4444 with the actual port in which the Grid2 is running.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"


James

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.


James

unread,
Nov 22, 2011, 11:17:34 PM11/22/11
to webdriver
Hi Krishnan,

I have selenium-server as a maven dependency. I have it running now
thanks to you. It works through robotframework like this as well.

Thank you so much.

Regards,
James

On Nov 23, 4:30 pm, Krishnan Mahadevan

Pavithra

unread,
Dec 5, 2011, 2:05:44 AM12/5/11
to webdriver
Hi James,
Even I am facing this issue recently with localhost. I am also running
with maven dependency.
How you resolved this ?

I am using the same configuration from long time and didn't face any
issues till now. Suddenly today I am getting this error.

Pavithra

> > > to get Firefox to run through aremotebrowser.  I have been trying


> > > the following code:
> > > rcc = new RemoteControlConfiguration();
> > > rcc.setPort(4447);
> > > rcc.setPortDriversShouldContact(4447);
> > > rcc.setInteractive(true);
> > > rcc.setSingleWindow(true);
> > > rcc.setTimeoutInSeconds(30);
> > > ss = new SeleniumServer(rcc);
> > > ss.start();
> > > DesiredCapabilities cap = new DesiredCapabilities();
>
> > > cap.setJavascriptEnabled(true);
> > > cap.setBrowserName("firefox");
> > > URL url = new URL ("http://www.google.com/");
> > > driver = new RemoteWebDriver(url,cap);
>
> > > However when I run the above I get the followingerrormessage:
>
> > > Exception in thread "main" org.openqa.selenium.WebDriverException:

> > >Errorcommunicatingwith theremotebrowser. It may have died.

Reply all
Reply to author
Forward
0 new messages