5

I am using Selenium to test a website in Java and trying to run it in Firefox on a MAC. But when I am trying to execute the code below

Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.example.com/");

I am getting the following runtime exception

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Browser not supported: /Users/sumitghosh/Desktop/*firefox3
(Did you forget to add a *?)

Supported browsers include:
  *firefox
  *mock
  *firefoxproxy
  *pifirefox
  *chrome
  *iexploreproxy
  *iexplore
  *firefox3
  *safariproxy
  *googlechrome
  *konqueror
  *firefox2
  *safari
  *piiexplore
  *firefoxchrome
  *opera
  *iehta
  *custom

I have also tried changing the browser to *googlechrome, but the same error was firing!

But when *safari was used it ran successfully.

Since I want the application to run on Windows and MAC also, I was trying for *firefox or *googlechrome to run, but both browsers are giving exceptions both on Windows and MAC!

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
Aspirant
  • 2,238
  • 9
  • 31
  • 43
  • What version of Firefox do you use? Do you have Firefox installed at the given location? Can you start Firefox on Windows with the same code? By the way, this is not selenium2 issue. – Petr Janeček Mar 28 '12 at 11:18
  • @Slanec even though if i do not specify any path for safari it was working fine !! but i can't get whats the problem with firefox !! No i even can't start firefox with the same code !! – Aspirant Mar 28 '12 at 12:07

2 Answers2

1

Instead of "*firefox" you can try "*firefox /Apps/Firefox/firefox.exe" or any other absolute path to the file firefox.exe which works for your computer.

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
  • I have tried to give absolute path like selenium = new DefaultSelenium("localhost", 4444, "/Users/mypc/Desktop/Firefox.app", "http://www.example.com/"); i have tried with different extensions like firefox.exe also and without extension too but still the same exception has been thrown !! – Aspirant Mar 28 '12 at 11:59
  • and even though if it works is there any other way to avoid the hard coding , as i will run the app in different platforms !! – Aspirant Mar 28 '12 at 12:02
  • That's strange. I guess you _really_ have unsupported version of firefox. I think versions 3, 3.5 and 3.6 should work, though. – Petr Janeček Mar 28 '12 at 12:44
  • may be you are right my browser version is Mozilla 11.0 !! i will try for version 3.5 !! but does selenium has compatibility issues for browsers ?? – Aspirant Mar 28 '12 at 14:13
  • For new Firefoxes (and other newer browsers), you should use the WebDriver API, also known as Selenium 2. The original Selenium RC has now been oficially deprecated. The new WebDriver works very well with new browsers, although it's always a race between browser's developers and selenium developers. – Petr Janeček Mar 28 '12 at 14:17
1

I have only ever got firefox 3.X to work on MACOSX with selenium.

Try downloading and installing a 3.X version (I got 3.18 to work).

Bohemian
  • 412,405
  • 93
  • 575
  • 722