In `method_missing': unknown property or method: `document' (NoMethodError)

1

Could someone explain what the following error means?

E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:488:in `method_missing': unknown property or method: `document' (NoMethodError)
HRESULT error code:0x80010108
  The object invoked has disconnected from its clients.
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:488:in `document'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/page-container.rb:31:in `page'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/page-container.rb:55:in `html'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/xpath_locator.rb:7:in `xmlparser_document_object'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/xpath_locator.rb:30:in `elements_by_xpath'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/locator.rb:111:in `locate_elements_by_xpath_css_ole'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/locator.rb:209:in `locate'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/input_elements.rb:5:in `locate'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/element.rb:63:in `assert_exists'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/element.rb:414:in `perform_action'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/element.rb:269:in `click!'
from E:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/element.rb:211:in `click'

I use some code in which I need to make the following checks - if needed title is found - attach those to the window, if not - attach window by its url.

class Title
  def initialize(title)
    @@a = title
    $ie=Watir::IE.attach(:title, @@a) 
    rescue Watir::Exception::NoMatchingWindowFoundException
    puts ("could not find browser")
    r.addtoReport(testReport, "check page element", "FAILED", "Page title not found")
  end
end


if Title.new("Company")
else 
  $ie=Watir::IE.attach(:title,"http://")
end

Another variant is:

class Title
  def initialize(title,title1)
    @@a = title
    @@b=title1
    $ie=Watir::IE.attach(:title, @@a)  
    rescue Watir::Exception::NoMatchingWindowFoundException
    puts ("could not find browser")
    r.addtoReport(testReport, "check page element", "FAILED", "Page title not found")
    else
    $ie=Watir::IE.attach(:url, @@b)  
  end
end

Title.new("Company","http://")

Before attaching window:

$ie.button(:xpath, "//input[contains(@onclick, \"path\")]").click
ruby
watir
asked on Stack Overflow Jul 9, 2012 by khris • edited Mar 8, 2013 by orde

1 Answer

0

Sorry for reviving an old post but this info must be somewhere. RE: It means watir is not founding the URL content. If you are pointing to localhost try running tests as administrator.

answered on Stack Overflow Apr 18, 2013 by Gabo

User contributions licensed under CC BY-SA 3.0