Web The root document
of a web page is not represented by a
Window node, but the special node Web page.
Nested document
nodes in frames
correspond to
Components nodes.
The DocumentNode
class is derived from Node
and also resides
in the package de.qfs.apps.qftest.client.web.dom
. In addition to the
methods defined in the Node
class and explained above,
DocumentNode
provides the following:
|
|
|
Object callJS(String code) |
Parameters |
code | The code to execute. |
Returns | Whatever the code returns explicitely using a return statement, converted to the proper object type. Even
returning a DOM node, frame or document works. |
|
Object evalJS(String script) |
Parameters |
script | The script to execute. |
Returns | Whatever the script returns, converted to the proper object type. Even
returning a DOM node, frame or document works. |
|
FrameNode[] getFrames() |
Returns |
The child frames of the document, an empty array in case there are none.
|
|
DomNode getRootElement() |
Returns | The root element of the document. |
|
String getSourcecode() |
Returns |
The current HTML code of the document.
|
|
String getTitle() |
Returns | The title of the document. |
|
String getUrl() |
Returns | The URL of the document. |
|
boolean hasParent() |
Returns |
True if the document has a parent, false if it is a top-level document.
|
|
|
|
In addition to the instance methods describe above, the DocumentNode
class
provides some static convenience methods for manipulating URLs.
|
|
|
static String getUrlBase(String url) |
Parameters |
url | The URL to get the base part of. |
Returns | The base part of the URL. |
|
static String getUrlHost(String url) |
Parameters |
url | The URL to get the host part of. |
Returns |
The host part of the URL or null if the protocol is neither http nor https.
|
|
static ExtraFeatureSet getUrlParameters(String url) |
Parameters |
url | The URL to get the parameters for. |
Returns |
The parameters of the URL.
|
|
static String normalizeUrl(String url) |
Parameters |
url | The URL to normalize. |
Returns |
The normalized URL.
|
|
|
|