Holen Sie sich HTML

const assert = require('assert')

describe('v5.webdriver.io', () => {

    it('should get html for certain elements', async () => {

        await browser.url('https://v5.webdriver.io');
        
        var outerHTML = await $('[href="/docs/api.html"]').getHTML();
        console.log('outer HTML: '  + outerHTML);
        // outputs:
        // "<div id="test"><span>Lorem ipsum dolor amet</span></div>"
    
        var innerHTML = await $('[href="/docs/api.html"]').getHTML(false);
        console.log('innerHTML: ' +innerHTML);
        // outputs:
        // "<span>Lorem ipsum dolor amet</span>"
    });
});    

Vivacious Vicuña