Just wanted to ask why Selenium RC is not able to work with recent Firefox versions?
Here is the code (groovy):
import org.openqa.selenium.server.*;
import com.thoughtworks.selenium.DefaultSelenium
import com.thoughtworks.selenium.Selenium
import com.thoughtworks.selenium.SeleniumException
import com.thoughtworks.selenium.Wait
import java.util.concurrent.TimeUnit
RemoteControlConfiguration rcc = new RemoteControlConfiguration()
System.out.println("Using firefox launcher")
File ffp = new File("C:\\Work\\ff_custom_profile")
rcc.setFirefoxProfileTemplate(ffp)
rcc.setPort(4444)
seleniumServer = new SeleniumServer(rcc)
seleniumServer.start()
System.out.println("Server started")
Selenium seleniumInstance = new DefaultSelenium("localhost", 4444, "firefox", "https://url/")
seleniumInstance.start()
System.out.println("Driver started");
When I run this code with Firefox 28 (Windows 7 x86), it works fine:
Using firefox launcher
20:46:35.692 INFO - Java: Sun Microsystems Inc. 20.14-b01
20:46:35.692 INFO - OS: Windows 7 6.1 x86
20:46:35.723 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
20:46:36.020 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:46:36.020 INFO - Version Jetty/5.1.x
20:46:36.020 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:46:36.035 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:46:36.035 INFO - Started HttpContext[/,/]
20:46:36.067 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1114460
20:46:36.067 INFO - Started HttpContext[/wd,/wd]
20:46:36.067 INFO - Started SocketListener on 0.0.0.0:4444
20:46:36.067 INFO - Started org.openqa.jetty.jetty.Server@15e0873
Server started
20:46:36.160 INFO - Checking Resource aliases
20:46:36.191 INFO - Command request: getNewBrowserSession[firefox, https://url/, ] on session null
20:46:36.207 INFO - creating new remote session
20:46:36.238 INFO - Allocated session 640d3bf362ab4840ad7c3f3ac2b5695d for https://url/, launching...
jar:file:/C:/Work/TMP/selenium-server-standalone-2.43.1.jar!/customProfileDirCUSTFFCHROME
20:46:36.925 INFO - Preparing Firefox profile...
20:46:38.127 INFO - Launching Firefox...
20:46:41.537 INFO - Got result: OK,640d3bf362ab4840ad7c3f3ac2b5695d on session 640d3bf362ab4840ad7c3f3ac2b5695d
Driver started
But when I run this code with Firefox 32 or 33 (Windows 7 x86), I gets the following:
Using firefox launcher
20:49:26.467 INFO - Java: Sun Microsystems Inc. 20.14-b01
20:49:26.467 INFO - OS: Windows 7 6.1 x86
20:49:26.467 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
20:49:26.576 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
20:49:26.576 INFO - Version Jetty/5.1.x
20:49:26.591 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
20:49:26.591 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:49:26.591 INFO - Started HttpContext[/,/]
20:49:26.607 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1114460
20:49:26.607 INFO - Started HttpContext[/wd,/wd]
20:49:26.623 INFO - Started SocketListener on 0.0.0.0:4444
20:49:26.623 INFO - Started org.openqa.jetty.jetty.Server@15e0873
Server started
20:49:26.669 INFO - Checking Resource aliases
20:49:26.669 INFO - Command request: getNewBrowserSession[firefox, https://url/, ] on session null
20:49:26.669 INFO - creating new remote session
20:49:26.685 INFO - Allocated session 740dfe19fd58418db02be166c420516d for https://url/, launching...
jar:file:/C:/Work/TMP/selenium-server-standalone-2.43.1.jar!/customProfileDirCUSTFFCHROME
20:49:27.247 INFO - Preparing Firefox profile...
20:49:28.386 INFO - Launching Firefox...
Please, note the difference in the output: with Firefox 28, Selenium client started successfully ...
20:46:41.537 INFO - Got result: OK,640d3bf362ab4840ad7c3f3ac2b5695d on session 640d3bf362ab4840ad7c3f3ac2b5695d
... while with Firefox 32 or 33 it failed.
I ran some experiments and found out that I can make it work in FF 32 or 33 by changing the following setting in Firefox profile (prefs.js):
user_pref("browser.startup.homepage_override.mstone", "33.1.1");
If I change it to the value that was in my FF 28 profile (16.0.2):
user_pref("browser.startup.homepage_override.mstone", "16.0.2");
then, it works fine. But I don't like this hack for two reasons:
When I open Firefox after this change with the script, it opens the Whatsnew page (https://www.mozilla.org/en-US/firefox/33.1.1/whatsnew/?oldversion=16.0.2) and it is very annoying for automation.
When I open Firefox after this change manually, this setting goes back to its previous value (33.1.1) and the story starts from the beginning.
I tried different Selenium RC version (2.41, 2.42, 2.43) with the same results.
With Firefox 32 & 33 and Selenium RC 2.44, I get the following error: Failed to start new browser session: java.lang.RuntimeException: java.lang.RuntimeException: Firefox could not be found in the path! Please add the directory containing ''firefox.exe'' to your PATH environment.
Well, I changed the code to...
Selenium seleniumInstance = new DefaultSelenium("localhost", 4444, "*firefox C:\Program Files\Mozilla Firefox\firefox.exe", "https://url/"
... and get the same failure as described above for Selenium 2.42 and 2.43.1.
So here is the question: why Firefox 32 or 33 doesn't work with Selenium RC, and how to make it work?
A note: I do realize it makes sense to migrate to Selenium 2 (WebDriver), but for some reasons, I need to support this legacy code at its current state.
Usually selenium will release a newer version of their client shortly after a browser update. Keep an eye on the downloads page.