getHTML

Get source code of specified DOM element by selector.

Usage

1
client.getHTML(selector[,includeSelectorTag]).then(callback);

Parameters

Param Type Details
selector String element to get the current DOM structure from
includeSelectorTag
optional
Boolean if true it includes the selector element tag (default: true)

Example

index.html
1
2
3
<div id="test">
<span>Lorem ipsum dolor amet</span>
</div>
getHTML.js
1
2
3
4
5
6
7
8
9
10
11
client
.getHTML('#test', function(err, html) {
console.log(html);
// outputs the following:
// "<div id="test"><span>Lorem ipsum dolor amet</span></div>"
})
.getHTML('#test', false, function(err, html) {
console.log(html);
// outputs the following:
// "<span>Lorem ipsum dolor amet</span>"
});

Uses