public interface DOMDocument extends SearchContext
Modifier and Type | Method and Description |
---|---|
DOMElement |
createElement(java.lang.String tagName)
Creates and returns a new DOM element with the specified tag name.
创建并返回具有指定标签名称的新DOM元素。 |
DOMEvent |
createEvent(DOMEventType eventType, DOMEventParams params)
Creates a new
使用给定的eventType和params创建一个新的DOMEvent对象。 DOMEvent object with the given
eventType and
params .
|
DOMKeyEvent |
createKeyEvent(DOMEventType eventType, DOMKeyEventParams params)
Creates a new
使用给定的eventType和params创建一个新的DOMKeyEvent对象。 DOMKeyEvent object with the given
eventType and
params .
|
DOMMouseEvent |
createMouseEvent(DOMEventType eventType, DOMMouseEventParams params)
Creates a new
使用给定的eventType和params创建一个新的DOMMouseEvent对象。 DOMMouseEvent object with the given
eventType and
params .
|
DOMNode |
createTextNode()
Creates and returns a new Text DOM node with
创建并返回具有DOMNodeType.TextNode类型的新Text DOM节点。 DOMNodeType.TextNode type.
|
DOMNode |
createTextNode(java.lang.String text)
Returns a new Text DOM node with
返回具有DOMNodeType.TextNode类型的新Text DOM节点。 DOMNodeType.TextNode type.
|
DOMUIEvent |
createUIEvent(DOMEventType eventType, DOMUIEventParams params)
Creates a new
使用给定的eventType和params创建一个新的DOMUIEvent对象。 DOMUIEvent object with the given
eventType and
params .
|
java.lang.String |
getBaseURI()
Returns the absolute base URL of the document
返回文档的绝对基础URL |
DOMElement |
getDocumentElement()
Returns the document HTML element that usually represents HTML tag.
返回通常表示HTML标签的文档HTML元素。 |
evaluate, evaluate, findElement, findElements
DOMElement getDocumentElement()
null
if document element is not available (e.g. the web page of this document was disposed).
null
if document element is not available.
通常表示HTML标记或如果文档元素不可用的文档HTML元素。
DOMElement createElement(java.lang.String tagName)
tagName
- the tag name (e.g. "A", "P", "DIV") of the new DOM element.
-新DOM元素的标签名称(例如“ A”,“ P”,“ DIV”)。
DOMElement
or
null
if
tagName
is wrong.
新的或如果是错误的。
java.lang.IllegalArgumentException
- when
tagName
parameter is empty or
null
.
DOMNode createTextNode()
DOMNodeType.TextNode
type.
DOMNodeType.TextNode
type.
类型的新Text DOM节点。
DOMNode createTextNode(java.lang.String text)
DOMNodeType.TextNode
type.
text
- the string, which will be used to initialize node value.
-字符串,将用于初始化节点值。
DOMNodeType.TextNode
type.
类型的新Text DOM节点。
java.lang.IllegalArgumentException
- when
text
parameter is empty or
null
.
DOMEvent createEvent(DOMEventType eventType, DOMEventParams params)
DOMEvent
object with the given
eventType
and
params
. The event object can be dispatched at specific
DOMEventTarget
using the
DOMEventTarget.dispatchEvent(DOMEvent)
method.
eventType
- the DOM event type. Cannot be
null
.
-DOM事件类型。不可能是 。
params
- the parameters of the event. Cannot be
null
.
-事件的参数。不可能是 。
DOMEvent
object.
一个新的对象。
DOMException
- when document fails to create DOM event.
DOMUIEvent createUIEvent(DOMEventType eventType, DOMUIEventParams params)
DOMUIEvent
object with the given
eventType
and
params
. The event object can be dispatched at specific
DOMEventTarget
using the
DOMEventTarget.dispatchEvent(DOMEvent)
method.
eventType
- the DOM event type. Cannot be
null
.
-DOM事件类型。不可能是 。
params
- the parameters of the event. Cannot be
null
.
-事件的参数。不可能是 。
DOMUIEvent
object.
一个新的对象。
DOMException
- when document fails to create DOM event.
DOMMouseEvent createMouseEvent(DOMEventType eventType, DOMMouseEventParams params)
DOMMouseEvent
object with the given
eventType
and
params
. The event object can be dispatched at specific
DOMEventTarget
using the
DOMEventTarget.dispatchEvent(DOMEvent)
method.
eventType
- the DOM event type. Cannot be
null
.
-DOM事件类型。不可能是 。
params
- the parameters of the event. Cannot be
null
.
-事件的参数。不可能是 。
DOMMouseEvent
object.
一个新的对象。
DOMException
- when document fails to create DOM event.
DOMKeyEvent createKeyEvent(DOMEventType eventType, DOMKeyEventParams params)
DOMKeyEvent
object with the given
eventType
and
params
. The event object can be dispatched at specific
DOMEventTarget
using the
DOMEventTarget.dispatchEvent(DOMEvent)
method.
Important: it's strongly recommended that the OnKeyDown
, OnKeyUp
, and OnKeyPress
event types are used when creating DOM key event. With other event types, Chromium engine might fail to create DOM key event and throw DOMException
.
eventType
- the DOM event type. Cannot be
null
.
-DOM事件类型。不可能是 。
params
- the parameters of the event. Cannot be
null
.
-事件的参数。不可能是 。
DOMKeyEvent
object.
一个新的对象。
DOMException
- when document fails to create DOM event.
java.lang.String getBaseURI()
"about:blank"
value for the case when nothing is loaded)