Class: Capybara::UI::Document

Inherits:
Object
  • Object
show all
Includes:
WidgetParts::Container
Defined in:
lib/capybara/ui/widgets/document.rb

Constant Summary

Constants included from Capybara::UI

VERSION

Instance Method Summary collapse

Methods included from WidgetParts::Container

#has_widget?, #not_visible?, #visible?, #widget, #widgets

Methods included from Capybara::UI

#deprecate

Methods included from Constructors

#Decimal, #Integer, #Widget

Constructor Details

#initialize(widget_lookup_scope) ⇒ Document

Returns a new instance of Document.


6
7
8
# File 'lib/capybara/ui/widgets/document.rb', line 6

def initialize(widget_lookup_scope)
  self.widget_lookup_scope = widget_lookup_scope or raise 'No scope given'
end

Instance Method Details

#bodyObject


14
15
16
17
18
# File 'lib/capybara/ui/widgets/document.rb', line 14

def body
  xml = Nokogiri::HTML(Capybara.page.body).to_xml

  Nokogiri::XML(xml, &:noblanks).to_xhtml
end

#rootObject


10
11
12
# File 'lib/capybara/ui/widgets/document.rb', line 10

def root
  Capybara.current_session
end