DotNetBrowser  1.14
Public Member Functions | Properties | List of all members
DotNetBrowser.DOM.DOMElement Interface Reference

Represents DOM HTML element. More...

Inherits DotNetBrowser.DOM.DOMNode.

Inherited by DotNetBrowser.DOM.DOMFormControlElement, DotNetBrowser.DOM.DOMFormElement, and DotNetBrowser.DOM.DOMOptionElement.

Public Member Functions

string GetAttribute (string name)
 Returns an attribute value by name . More...
 
bool SetAttribute (string name, string value)
 Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. More...
 
void RemoveAttribute (string name)
 Removes an attribute specified by name . More...
 
bool HasAttribute (string name)
 Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise. More...
 
bool SetInnerHTML (string html)
 Replaces inner HTML of the current element with specified html. More...
 
bool SetInnerText (string text)
 Replaces inner text of the current element with specified html. More...
 
void Focus ()
 Give focus to the current element More...
 
void Blur ()
 Remove focus from the current element More...
 
- Public Member Functions inherited from DotNetBrowser.DOM.DOMNode
List< DOMNodeGetElementsByTagName (string tagName)
 Returns a list of DOM nodes with specific tagName . More...
 
List< DOMNodeGetElementsByName (string name)
 Returns a list of DOM nodes whose name attribute is given by name . More...
 
List< DOMNodeGetElementsByClassName (string className)
 Returns a list of DOM nodes whose class attribute is given by className . More...
 
void Click ()
 Simulates click on the current Node. More...
 
DOMNode QuerySelector (string selectors)
 Returns the first DOM node from children of the current node, that match any selector within selectors string. More...
 
List< DOMNodeQuerySelectorAll (string selectors)
 Returns a list of DOM nodes from children of the current node, that match any selector within selectors string. More...
 
bool InsertChild (DOMNode node, DOMNode beforeNode)
 Inserts a new node before an existing beforeNode. The new node could be an existing node in the document, or you can create and insert a new node. If the node is existing node, it will be moved to new location in the document. More...
 
bool ReplaceChild (DOMNode newNode, DOMNode oldNode)
 Replaces existing child node with a new node. The new node could be an existing node in the document, or you can create a new node. If the newNode is existing node, it will be moved to new location in the document. The old node could be used for inserting/appending it into the document later. More...
 
bool RemoveChild (DOMNode childNode)
 Removes a child node and notifies whether child node was removed from the current node successfully or not. More...
 
bool AppendChild (DOMNode childNode)
 Appends a node as the last child of the current node. The new node could be an existing node in the document, or you can create a new node. If the childNode is existing node, it will be moved to new location in the document. More...
 
- Public Member Functions inherited from DotNetBrowser.DOM.Events.DOMEventTarget
void AddEventListener (DOMEventType eventType, DOMEventHandler handler, bool useCapture)
 This method allows the registration of event listeners on the event target. If an DOMEventHandler is added to an DOMEventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical DOMEventHandlers are registered on the same DOMEventTarget with the same parameters the duplicate instances are discarded. They do not cause the DOMEventHandler to be called twice and since they are discarded they do not need to be removed with the RemoveEventListener method. More...
 
void AddEventListener (DOMEvent domEvent, DOMEventHandler handler, bool useCapture)
 This method allows the registration of event listeners on the event target. If an DOMEventHandler is added to an DOMEventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical DOMEventHandlers are registered on the same DOMEventTarget with the same parameters the duplicate instances are discarded. They do not cause the DOMEventHandler to be called twice and since they are discarded they do not need to be removed with the RemoveEventListener method. More...
 
void RemoveEventListener (DOMEventType eventType, DOMEventHandler handler, bool useCapture)
 This method allows the removal of event listeners from the event target. If an DOMEventHandler is removed from an DOMEventTarget while it is processing an event, it will not be triggered by the current actions. DOMEventHandlers can never be invoked after being removed.
Calling RemoveEventListener with arguments which do not identify any currently registered DOMEventHandler on the DOMEventTarget has no effect. More...
 
void RemoveEventListener (DOMEvent domEvent, DOMEventHandler handler, bool useCapture)
 This method allows the removal of event listeners from the event target. If an DOMEventHandler is removed from an DOMEventTarget while it is processing an event, it will not be triggered by the current actions. DOMEventHandlers can never be invoked after being removed.
Calling RemoveEventListener with arguments which do not identify any currently registered DOMEventHandler on the DOMEventTarget has no effect. More...
 
List< DOMEventHandlerGetEventListeners (DOMEventType eventType)
 Returns a list of registered DOMEventHandler's for specific eventType. More...
 
List< DOMEventHandlerGetEventListeners (DOMEvent domEvent)
 Returns a list of registered DOMEventHandler's for specific custom event. More...
 
bool DispatchEvent (DOMEvent domEvent)
 Sends an event to the current element. More...
 
- Public Member Functions inherited from DotNetBrowser.DOM.SearchContext
DOMElement GetElementByTagName (string tagName)
 Finds first DOM element in the current document or element with the given tagName . Returns null if element wasn't found using given find method. More...
 
DOMElement GetElementByName (string name)
 Finds first DOM element in the current document or element with the given name . Returns null if element wasn't found using given find method. More...
 
DOMElement GetElementByClassName (string className)
 Finds first DOM element in the current document or element with the given className . Returns null if element wasn't found using given find method. More...
 
XPathResult Evaluate (string expression)
 Evaluates an XPath expression for the document element with XPathResultType.ANY_TYPE and returns the result. Equivalent of: More...
 
XPathResult Evaluate (string expression, XPathResultType type)
 Returns an XPathResult based on an XPath expression and other given parameters. More...
 

Properties

Dictionary< string, string > Attributes [get]
 Returns a dictionary that contains attributes of the current element. More...
 
string InnerHTML [get]
 Returns a string that represents inner HTML of the current element. More...
 
string InnerText [get]
 Returns a string that represents inner text of the current element. More...
 
int OffsetLeft [get]
 Gets the horizontal offset position of the current element More...
 
int OffsetTop [get]
 Gets the vertical offset position of the current element More...
 
int OffsetWidth [get]
 Gets the width of the current element, including padding, border and scrollbar More...
 
int OffsetHeight [get]
 Gets the height of the current element, including padding, border and scrollbar More...
 
int ClientLeft [get]
 Gets the width of the left border of the current element More...
 
int ClientTop [get]
 Gets the width of the top border of the current element More...
 
int ClientWidth [get]
 Gets the width of the current element, including padding More...
 
int ClientHeight [get]
 Gets the height of the current element, including padding More...
 
double ScrollLeft [get, set]
 Gets or sets the number of pixels an element's content is scrolled horizontally More...
 
double ScrollTop [get, set]
 Gets or sets the number of pixels an element's content is scrolled vertically More...
 
int ScrollWidth [get]
 Gets the entire width of the current element, including padding More...
 
int ScrollHeight [get]
 Gets the entire height of the current element, including padding More...
 
Rectangle BoundingClientRect [get]
 Returns bounds of the element and its position relative to the top-left of the viewport of the current document. More...
 
- Properties inherited from DotNetBrowser.DOM.DOMNode
string NodeName [get]
 Gets the name of this node, depending on its DOMNodeType. More...
 
string NodeValue [get, set]
 Gets or sets the value of this node, depending on its DOMNodeType. More...
 
DOMNodeType NodeType [get]
 Gets the type of this node. More...
 
DOMNode Parent [get]
 Gets parent node or null if there's no parent. More...
 
List< DOMNodeChildren [get]
 Gets a list of child node of this node. More...
 
string XPath [get]
 Gets the xpath of this node More...
 
string TextContent [get, set]
 Gets or sets text content of the node and its descendants. More...
 
DOMNode NextSibling [get]
 Gets the node immediately following this one in its parent's children list, or null if this node is the last node in the list. More...
 
DOMNode PreviousSibling [get]
 Gets the node immediately preceding this one in its parent's children list, or null if this node is the first node in that list. More...
 

Detailed Description

Represents DOM HTML element.

Member Function Documentation

void DotNetBrowser.DOM.DOMElement.Blur ( )

Remove focus from the current element

void DotNetBrowser.DOM.DOMElement.Focus ( )

Give focus to the current element

string DotNetBrowser.DOM.DOMElement.GetAttribute ( string  name)

Returns an attribute value by name .

Parameters
namethe attribute name.
Returns
a string that represents an attribute value or empty string if the value isn't exist.
Exceptions
ArgumentExceptionif name parameter is null or empty. HasAttribute(String)
bool DotNetBrowser.DOM.DOMElement.HasAttribute ( string  name)

Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.

Parameters
namethe name of the attribute to look for.
Returns
true if an attribute with the given name is specified on this element or has a default value, false otherwise.
Exceptions
ArgumentExceptionif name parameter is null or empty.
void DotNetBrowser.DOM.DOMElement.RemoveAttribute ( string  name)

Removes an attribute specified by name .

Parameters
namethe name of the attribute to remove.
Exceptions
ArgumentExceptionif name parameter is null or empty.
bool DotNetBrowser.DOM.DOMElement.SetAttribute ( string  name,
string  value 
)

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter.

Parameters
namethe name of the attribute to create or alter.
valuevalue to set in string form.
Returns
true when attribute was added successfully.
Exceptions
ArgumentExceptionif name or value parameter is null or empty.
bool DotNetBrowser.DOM.DOMElement.SetInnerHTML ( string  html)

Replaces inner HTML of the current element with specified html.

Parameters
htmla new inner HTML of the current element.
Returns
true when HTML code of the current element was replaced successfully.
bool DotNetBrowser.DOM.DOMElement.SetInnerText ( string  text)

Replaces inner text of the current element with specified html.

Parameters
texta new inner text of the current element.
Returns
true when text of the current element was replaced successfully.
See also
TextContent

Property Documentation

Dictionary<string, string> DotNetBrowser.DOM.DOMElement.Attributes
get

Returns a dictionary that contains attributes of the current element.

Returns
a dictionary that contains attributes of the current element. Returns empty map if the current element doesn't have any attribute.
Rectangle DotNetBrowser.DOM.DOMElement.BoundingClientRect
get

Returns bounds of the element and its position relative to the top-left of the viewport of the current document.

The amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the bounding rectangle. This means that the rectangle's boundary edges (top, left, bottom, and right) change their values every time the scrolling position changes (because their values are relative to the viewport and not absolute). If you need the bounding rectangle relative to the top-left corner of the document, just add the current scrolling position to the top and left properties (these can be obtained using window.scrollX and window.scrollY) to get a bounding rectangle which is independent from the current scrolling position.

int DotNetBrowser.DOM.DOMElement.ClientHeight
get

Gets the height of the current element, including padding

int DotNetBrowser.DOM.DOMElement.ClientLeft
get

Gets the width of the left border of the current element

int DotNetBrowser.DOM.DOMElement.ClientTop
get

Gets the width of the top border of the current element

int DotNetBrowser.DOM.DOMElement.ClientWidth
get

Gets the width of the current element, including padding

string DotNetBrowser.DOM.DOMElement.InnerHTML
get

Returns a string that represents inner HTML of the current element.

Returns
a string that represents inner HTML of the current element or empty string if the current element doesn't have inner HTML or the element doesn't exist anymore.
string DotNetBrowser.DOM.DOMElement.InnerText
get

Returns a string that represents inner text of the current element.

Returns
a string that represents inner text of the current element or empty string if the current element doesn't have inner text or the element doesn't exist anymore.
See also
TextContent
int DotNetBrowser.DOM.DOMElement.OffsetHeight
get

Gets the height of the current element, including padding, border and scrollbar

int DotNetBrowser.DOM.DOMElement.OffsetLeft
get

Gets the horizontal offset position of the current element

int DotNetBrowser.DOM.DOMElement.OffsetTop
get

Gets the vertical offset position of the current element

int DotNetBrowser.DOM.DOMElement.OffsetWidth
get

Gets the width of the current element, including padding, border and scrollbar

int DotNetBrowser.DOM.DOMElement.ScrollHeight
get

Gets the entire height of the current element, including padding

double DotNetBrowser.DOM.DOMElement.ScrollLeft
getset

Gets or sets the number of pixels an element's content is scrolled horizontally

double DotNetBrowser.DOM.DOMElement.ScrollTop
getset

Gets or sets the number of pixels an element's content is scrolled vertically

int DotNetBrowser.DOM.DOMElement.ScrollWidth
get

Gets the entire width of the current element, including padding