Problem connecting to localhost using watir

I have a set of tests for cucumbers, which usually work fine against our site. But if I make any changes and want to run the tests locally, the tests stop immediately, even before the bootstrap completes.

I tried in IRB without a cucumber and got the same error using the following code:

require 'rubygems'
require 'watir'

browser = Watir::Browser.new
browser.goto("http://localhost:1234/somepath")

browser.text_field(:id, 'Username').set('jimbob')

Cannot complete the following:

WIN32OLERuntimeError: unknown property or method `document'
    HRESULT error code:0x800706b5
      The interface is unknown.
        from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/ie-class.rb:467:in `method_missing'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/ie-class.rb:467:in `document'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/container.rb:836:in `locate_input_element'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/input_elements.rb:5:in `locate'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/element.rb:55:in `assert_exists'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.7.1/lib/watir/input_elements.rb:366:in `set'

Versions:

  • OS: Windows 7
  • Browser: IE8
  • Ruby: 1.8.7 (I tried using 1.9.2, but it had no problems)
  • Watir: 1.7.1
+3
source share
2 answers

You need to run as administrator in Windows 7 when using Watir vs localhost.

http://chowamigo.blogspot.com/2010/03/setting-up-cucumber-to-use-watir-test.html

+1

Server2008, watir. - IE .

0

Source: https://habr.com/ru/post/1794004/


All Articles