Get the string serialized source of the current page.

Usage

                    .document.source([callback])
                

Example

module.exports = {
  'get page source': function (browser) {
     browser.document.source(function (result) {
       console.log('current page source:', result.value);
     });
  },

  'get page source using ES6 async/await': async function (browser) {
     const pageSource = await browser.document.source();
     console.log('current page source:', pageSource);
  }
};

Parameters

Name Type description
callback
Optional
function

Callback function which is called with the result value.

Returns

Type description
string

String serialized source of the current page.

W3C WebDriver spec