@testplane/webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
36 lines (34 loc) • 1.48 kB
TypeScript
/**
*
* Get source code of specified DOM element by selector.
*
* <example>
:index.html
<div id="test">
<span>Lorem ipsum dolor amet</span>
</div>
:getHTML.js
it('should get html for certain elements', async () => {
var outerHTML = await $('#test').getHTML();
console.log(outerHTML);
// outputs:
// "<div id="test"><span>Lorem ipsum dolor amet</span></div>"
var innerHTML = await $('#test').getHTML(false);
console.log(innerHTML);
// outputs:
// "<span>Lorem ipsum dolor amet</span>"
});
* </example>
*
* @alias element.getHTML
* @param {GetHTMLOptions} options command options
* @param {Boolean=} options.includeSelectorTag if true it includes the selector element tag (default: `true`)
* @param {Boolean=} options.pierceShadowRoot if true it includes content of the shadow roots of all web components in the DOM (default: `true`)
* @param {Boolean=} options.removeCommentNodes if true it removes all comment nodes from the HTML, e.g. `<!--?lit$206212805$--><!--?lit$206212805$-->` (default: `true`)
* @param {Boolean=} options.prettify if true, the html output will be prettified (default: `true`)
* @return {String} the HTML of the specified element
* @uses action/selectorExecute
* @type property
*
*/
export declare function getHTML(this: WebdriverIO.Element, includeSelectorTag?: boolean): Promise<string>;