Class: Watir::HTMLElements
Instance Method Summary
collapse
#[], #first, #get_length_of_input_objects, #inspect, #last, #show, #to_s
Constructor Details
#initialize(container, how, what) ⇒ HTMLElements
Returns a new instance of HTMLElements.
364
365
366
367
368
369
370
371
372
|
# File 'lib/watir/collections.rb', line 364
def initialize(container, how, what)
@how = how
@what = what
if how == :index
raise MissingWayOfFindingObjectException,
"#{self.class} does not support attribute #{@how}"
end
super(container)
end
|
Instance Method Details
#each ⇒ Object
381
382
383
|
# File 'lib/watir/collections.rb', line 381
def each
@container.locate_all_elements(@how, @what).each { |element| yield element }
end
|
#element_class ⇒ Object
361
|
# File 'lib/watir/collections.rb', line 361
def element_class; HTMLElement; end
|
#element_tag ⇒ Object
362
|
# File 'lib/watir/collections.rb', line 362
def element_tag; '*'; end
|
#iterator_object(i) ⇒ Object
385
386
387
388
|
# File 'lib/watir/collections.rb', line 385
def iterator_object(i)
count = 0
each {|e| return e if count == i;count += 1;}
end
|
#length ⇒ Object
Also known as:
size
374
375
376
377
378
|
# File 'lib/watir/collections.rb', line 374
def length
count = 0
each {|element| count += 1 }
count
end
|