Class: WatirNokogiri::Document
- Inherits:
-
Object
- Object
- WatirNokogiri::Document
show all
- Includes:
- Container
- Defined in:
- lib/watir-nokogiri/document.rb
Overview
The main class through which you control the html.
Instance Attribute Summary collapse
-
#driver ⇒ Object
(also: #nokogiri)
readonly
Returns the value of attribute driver.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Container
#a, #abbr, #abbrs, #address, #addresses, #area, #areas, #article, #articles, #as, #aside, #asides, #audio, #audios, #b, #base, #bases, #bdi, #bdis, #bdo, #bdos, #blockquote, #blockquotes, #body, #bodys, #br, #brs, #bs, #button, #buttons, #canvas, #canvases, #caption, #captions, #checkbox, #checkboxes, #cite, #cites, #code, #codes, #col, #colgroup, #colgroups, #cols, #command, #commands, #data, #datalist, #datalists, #datas, #dd, #dds, #del, #dels, #details, #detailses, #dfn, #dfns, #dialog, #dialogs, #div, #divs, #dl, #dls, #dt, #dts, #element, #elements, #em, #embed, #embeds, #ems, #extract_selector, #field_set, #field_sets, #fieldset, #fieldsets, #figcaption, #figcaptions, #figure, #figures, #file_field, #file_fields, #font, #fonts, #footer, #footers, #form, #forms, #frame, #frames, #frameset, #framesets, #h1, #h1s, #h2, #h2s, #h3, #h3s, #h4, #h4s, #h5, #h5s, #h6, #h6s, #head, #header, #headers, #heads, #hgroup, #hgroups, #hidden, #hiddens, #hr, #hrs, #htmls, #i, #iframe, #iframes, #image, #images, #img, #imgs, #input, #inputs, #ins, #inses, #is, #kbd, #kbds, #keygen, #keygens, #label, #labels, #legend, #legends, #li, #link, #links, #lis, #map, #maps, #mark, #marks, #menu, #menus, #meta, #metas, #meter, #meters, #nav, #navs, #noscript, #noscripts, #object, #objects, #ol, #ols, #optgroup, #optgroups, #option, #options, #output, #outputs, #p, #param, #params, #pre, #pres, #progress, #progresses, #ps, #q, #qs, #radio, #radios, #rp, #rps, #rt, #rts, #rubies, #ruby, #s, #samp, #samps, #script, #scripts, #section, #sections, #select, #select_list, #select_lists, #selects, #small, #smalls, #source, #sources, #span, #spans, #ss, #strong, #strongs, #style, #styles, #sub, #subs, #summaries, #summary, #sup, #sups, #table, #tables, #tbody, #tbodys, #td, #tds, #text_field, #text_fields, #textarea, #textareas, #tfoot, #tfoots, #th, #thead, #theads, #ths, #time, #times, #titles, #tr, #track, #tracks, #trs, #u, #ul, #uls, #us, #var, #vars, #video, #videos, #wbr, #wbrs
Constructor Details
#initialize(html = '') ⇒ Document
Creates a WatirNokogiri::HTML instance.
27
28
29
|
# File 'lib/watir-nokogiri/document.rb', line 27
def initialize(html = '')
@driver = Nokogiri::HTML.parse(html)
end
|
Instance Attribute Details
#driver ⇒ Object
Also known as:
nokogiri
Returns the value of attribute driver.
11
12
13
|
# File 'lib/watir-nokogiri/document.rb', line 11
def driver
@driver
end
|
Class Method Details
.start(file_path) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/watir-nokogiri/document.rb', line 15
def start(file_path)
b = new()
b.goto file_path
b
end
|
Instance Method Details
#add_checker(checker = nil, &block) ⇒ Object
135
136
137
|
# File 'lib/watir-nokogiri/document.rb', line 135
def add_checker(checker = nil, &block)
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
103
104
105
|
# File 'lib/watir-nokogiri/document.rb', line 103
def alert
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#assert_exists ⇒ Object
158
159
160
|
# File 'lib/watir-nokogiri/document.rb', line 158
def assert_exists
true
end
|
52
53
54
|
# File 'lib/watir-nokogiri/document.rb', line 52
def back
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#close ⇒ Object
Also known as:
quit
69
70
71
|
# File 'lib/watir-nokogiri/document.rb', line 69
def close
@driver = nil
end
|
74
75
76
|
# File 'lib/watir-nokogiri/document.rb', line 74
def cookies
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#disable_checker(checker) ⇒ Object
139
140
141
|
# File 'lib/watir-nokogiri/document.rb', line 139
def disable_checker(checker)
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
166
167
168
|
# File 'lib/watir-nokogiri/document.rb', line 166
def document
self
end
|
#execute_script(script, *args) ⇒ Object
123
124
125
|
# File 'lib/watir-nokogiri/document.rb', line 123
def execute_script(script, *args)
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#exist? ⇒ Boolean
Also known as:
exists?
Returns true if html has been supplied and false otherwise.
153
154
155
|
# File 'lib/watir-nokogiri/document.rb', line 153
def exist?
!@driver.nil?
end
|
56
57
58
|
# File 'lib/watir-nokogiri/document.rb', line 56
def forward
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#goto(file_path) ⇒ String
Reads the given file as HTML.
47
48
49
50
|
# File 'lib/watir-nokogiri/document.rb', line 47
def goto(file_path)
html = File.read(file_path)
@driver = Nokogiri::HTML.parse(html)
end
|
#html ⇒ String
Returns HTML code of current page.
98
99
100
101
|
# File 'lib/watir-nokogiri/document.rb', line 98
def html
@driver.at_css('html').to_html
end
|
31
32
33
34
35
|
# File 'lib/watir-nokogiri/document.rb', line 31
def inspect
'#<%s:0x%x>' % [self.class, hash*2]
rescue
'#<%s:0x%x closed=%s>' % [self.class, hash*2, exist?.to_s]
end
|
78
79
80
|
# File 'lib/watir-nokogiri/document.rb', line 78
def name
:nokogiri
end
|
#ready_state ⇒ Object
115
116
117
|
# File 'lib/watir-nokogiri/document.rb', line 115
def ready_state
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
107
108
109
|
# File 'lib/watir-nokogiri/document.rb', line 107
def refresh
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
162
163
164
|
# File 'lib/watir-nokogiri/document.rb', line 162
def reset!
end
|
#run_checkers ⇒ Object
143
144
145
|
# File 'lib/watir-nokogiri/document.rb', line 143
def run_checkers
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#screenshot ⇒ Object
131
132
133
|
# File 'lib/watir-nokogiri/document.rb', line 131
def screenshot
Screenshot.new driver
end
|
#send_keys(*args) ⇒ Object
127
128
129
|
# File 'lib/watir-nokogiri/document.rb', line 127
def send_keys(*args)
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
119
120
121
|
# File 'lib/watir-nokogiri/document.rb', line 119
def status
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#text ⇒ String
Returns text of page body.
88
89
90
|
# File 'lib/watir-nokogiri/document.rb', line 88
def text
@driver.at_css('body').text
end
|
65
66
67
|
# File 'lib/watir-nokogiri/document.rb', line 65
def title
@driver.title
end
|
60
61
62
63
|
# File 'lib/watir-nokogiri/document.rb', line 60
def url
assert_exists
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|
#wait(timeout = 5) ⇒ Object
111
112
113
|
# File 'lib/watir-nokogiri/document.rb', line 111
def wait(timeout = 5)
raise NotImplementedError, "not currently supported by WatirNokogiri"
end
|