Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I'm writing my test cases in Windows7 with Ruby (v1.9.3-p194).

Please, note that I want to specify Firefox binary path when using RemoteWebDriver, not FirefoxDriver.

Here is the command line I used to start Selenium server 2.25.0:

"%JAVA_HOME%\bin\java" -jar selenium-server-standalone.jar

And here is the Ruby code I used to initialize webdriver in my test suite:

@capa = Selenium::WebDriver::Remote::Capabilities.firefox
@capa[:firefox_binary] = "D:\FirefoxStuff\FF13.0.1\firefox.exe"
@remote_server_url = "http://127.0.0.1:4444/wd/hub"
@driver = Selenium::WebDriver.for(:remote, {:url => @remote_server_url, :desired_capabilities => @capa})

However when I execute the test case, an error says Selenium::WebDriver::Error::UnknownError: Cannot find firefox binary in PATH. So, it's obvious my binary path specification is not working.

Does anybody know how to achieve that besides setting my PATH?

share|improve this question
add comment

1 Answer

I'm looking at this too. Seems there is a bit of problem in as_json in Selenium::WebDriver::Remote::Capabilities

firefox_binary get's re-written to firefoxBinary in the json call to webdriver grid, this means that the binary you have supplied does not register as it's assigned to the wrong key.

Chaning:

def as_json(opts = nil)
      hash = {}

      @capabilities.each do |key, value|
        case key
        when :platform
          hash['platform'] = value.to_s.upcase
        when :firefox_profile
          hash['firefox_profile'] = value.as_json['zip'] if value
        when :proxy
          hash['proxy'] = value.as_json if value
        when String
          hash[key] = value
        when Symbol
          hash[camel_case(key.to_s)] = value
        else
          raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
        end
      end

      hash
    end

to

def as_json(opts = nil)
      hash = {}

      @capabilities.each do |key, value|
        case key
        when :platform
          hash['platform'] = value.to_s.upcase
        when :firefox_profile
          hash['firefox_profile'] = value.as_json['zip'] if value
        when :proxy
          hash['proxy'] = value.as_json if value
        when :firefox_binary
          hash['firefox_binary'] = value
        when String
          hash[key] = value
        when Symbol
          hash[camel_case(key.to_s)] = value
        else
          raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
        end
      end

      hash
    end

Seems to work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.