2
votes

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?

2
I have tried changing registry settings too nothing seems to work. - sai charan
Are you requiring watir or watir-webdriver ? When you run gem list watir what is listed (including version numbers)? Which lines of your code do the two errors above point to as failing, and can you show us those? - Chuck van der Linden
I tried requiring both watir and watir-webdriver resulted in the same. I am using page-object gem with the watir. gem list watir has given this result: commonwatir (4.0.0) watir (6.10.2, 5.0.0 x86-mingw32, 4.0.2 x86-mingw32) watir-classic (4.3.0, 3.7.0) watir-webdriver (0.9.9, 0.9.1). The error is pointing to the code which is entering the first field it is expecting. - sai charan
Watir::Exception::NoMatchingWindowFoundException: browser window was closed (eval):1:in process_watir_call' ./features/support/pages/Messaging/login_page.rb:66:in enter_username_forward_receiver' ./features/step_definitions/loginpage.rb:21:in /^I enter my username and click on continue$/' ./features/Messages/loginpage.feature:11:in When I enter my username and click on continue' - sai charan
Chuck van der Linden thank you for responding found the solutions for both. - sai charan

2 Answers

2
votes

The problem with chrome has been fixed by using the right chromedriver version, but still having problems with the IE using watir.

2
votes

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.