Search code examples
rubytestingcucumberwatirrubymine

ruby cucumber tests on multiple browsers


I am using windows 10 32 bit ruby version 233, I am facing these issues with running the tests on a ie 11 browser and the chrome browser for the tests(using page object) that are already running on firefox browser,

ISSUE with IE: Watir::Exception::NoMatchingWindowFoundException: browser window was closed (eval):1:in `process_watir_call'

ISSUE with Chrome: Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:9515 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 9515)

i have used the following hooks for ie and chrome:

Before do
  case $browser
    when 'mozilla'
      @browser = Watir::Browser.new :firefox
      @browser.window.maximize
    when 'chrome'
      @browser = Watir::Browser.new :chrome, :profile => "default"
    when 'ie'
      @browser = Watir::Browser.new :ie
      # @browser.window.maximize
      # @browser.visible = true
    else
      @browser = Watir::Browser.new :firefox
      @browser.window.maximize
  end

  # @browser = Watir::Browser.new :firefox
  # @browser.window.maximize
  # this file contains test data that needs to be changed if tests are being executed in a different environment
  $test_data = YAML.load_file('features/support/input_data/data/login_information.yml')
  # this file contains base URL that needs to be changed if tests are being executed in a different environment
  FigNewton.load('default.yml')
end

I was able to run a small sample test on a separate project from ruby mine with Watir gem. Is there any way to make it work on the existing firefox tests?


Solution

  • Found the solution for IE too its something to do with the internet options security and lower down the security level and uncheck the Enable Protected Mode.