Class: IEgrip::HTMLElement
Overview
Constant Summary
Constants inherited
from Node
Node::NODETYPE_DIC
Instance Method Summary
collapse
#getElementByName, #getElementByText, #getElementByTitle, #getElementByValue, #getElementsByName, #getElementsByTagName, #getElementsByText, #getElementsByTitle, #getElementsByValue
#childElements, #childNodes, #contains, #firstChild, #hasChildElements, #hasChildNodes, #isEqualNode, #lastChild, #nextSibling, #previousSibling, #struct
#getParentForm, #parentElement, #parentNode
Methods inherited from Node
#nodeName, #nodeType, #nodeTypeName
Methods inherited from GripWrapper
#initialize, #ole_methodNames, #raw
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class IEgrip::GripWrapper
Instance Method Details
#addElement(new_element) ⇒ Object
538
539
540
541
542
543
544
545
546
|
# File 'lib/iegrip.rb', line 538
def addElement(new_element)
parent = self.parentElement
next_element = self.nextSibling
if next_element
parent.insertBefore(new_element, next_element)
else
parent.appendChild(new_element)
end
end
|
#appendChild(newElement) ⇒ Object
526
527
528
|
# File 'lib/iegrip.rb', line 526
def appendChild(newElement)
@raw_object.appendChild(toRaw(newElement))
end
|
#click ⇒ Object
475
476
477
478
479
480
481
482
|
# File 'lib/iegrip.rb', line 475
def click
if @ie_obj.version >= 10
@raw_object.click(false)
else
@raw_object.click
end
@ie_obj.wait_stable()
end
|
#export(filename) ⇒ Object
489
490
491
492
493
494
495
496
497
498
|
# File 'lib/iegrip.rb', line 489
def export(filename)
case self.tagName.downcase
when "img"
@ie_obj.export(self.src, filename)
when "a"
@ie_obj.export(self.href, filename)
else
raise "export() is not support."
end
end
|
#getAttribute(attr_name) ⇒ Object
504
505
506
|
# File 'lib/iegrip.rb', line 504
def getAttribute(attr_name)
@raw_object.getAttribute(attr_name)
end
|
#getAttributeNode(attr_name) ⇒ Object
508
509
510
511
|
# File 'lib/iegrip.rb', line 508
def getAttributeNode(attr_name)
raw_attr = @raw_object.getAttributeNode(attr_name)
raw_attr ? Attr.new(raw_attr, @ie_obj) : nil
end
|
#insertBefore(newElement, anchor_element = nil) ⇒ Object
522
523
524
|
# File 'lib/iegrip.rb', line 522
def insertBefore(newElement, anchor_element=nil)
@raw_object.insertBefore(toRaw(newElement), toRaw(anchor_element))
end
|
#inspect ⇒ Object
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
# File 'lib/iegrip.rb', line 451
def inspect()
case tagName
when "SELECT"
innerHTML = replace_cr_code(self.innerHTML)
"<#{self.class}, TAG:#{tagName}, [#{self.innerHTML}]"
when "INPUT", "IMG", "A"
outerHTML = replace_cr_code(self.outerHTML)
"<#{self.class}, TAG:#{tagName}, [#{self.outerHTML}]"
when "TR", "TD"
innerText = replace_cr_code(self.innerText)
"<#{self.class}, TAG:#{tagName}, [#{innerText}]"
else
"<#{self.class}, TAG:#{tagName}>"
end
end
|
#removeAttribute(attr_name) ⇒ Object
513
514
515
|
# File 'lib/iegrip.rb', line 513
def removeAttribute(attr_name)
@raw_object.removeAttribute(attr_name)
end
|
#removeAttributeNode(attr) ⇒ Object
517
518
519
520
|
# File 'lib/iegrip.rb', line 517
def removeAttributeNode( attr )
raw_attr = @raw_object.removeAttributeNode( toRaw(attr) )
raw_attr ? Attr.new(raw_attr, @ie_obj) : nil
end
|
#removeChild(element) ⇒ Object
530
531
532
|
# File 'lib/iegrip.rb', line 530
def removeChild(element)
@raw_object.removeChild(toRaw(element))
end
|
#replaceChild(newElement, oldElement) ⇒ Object
534
535
536
|
# File 'lib/iegrip.rb', line 534
def replaceChild(newElement, oldElement)
@raw_object.replaceChild(toRaw(newElement), toRaw(oldElement))
end
|
#setAttributeNode(attribute) ⇒ Object
500
501
502
|
# File 'lib/iegrip.rb', line 500
def setAttributeNode(attribute)
@raw_object.setAttributeNode(toRaw(attribute));
end
|
#tagname ⇒ Object
427
428
429
430
431
432
433
|
# File 'lib/iegrip.rb', line 427
def tagname
if self.nodeType == 8
"comment"
else
@raw_object.tagName.downcase
end
end
|
#text=(set_text) ⇒ Object
435
436
437
438
439
440
441
442
443
444
445
446
447
448
|
# File 'lib/iegrip.rb', line 435
def text=(set_text)
case self.tagname
when "select"
option_list = elements("OPTION")
option_list.each {|option_element|
if option_element.innerText == set_text
option_element.selected = true
break
end
}
else
@raw_object.value = set_text
end
end
|
#to_s ⇒ Object
467
468
469
|
# File 'lib/iegrip.rb', line 467
def to_s
@raw_object.value
end
|
#value ⇒ Object
Also known as:
text
470
471
472
|
# File 'lib/iegrip.rb', line 470
def value
@raw_object.value
end
|