Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,9 @@ class WebDriver extends Helper {
* * *Appium*: supported only for web testing
*/
async grabHTMLFrom(locator) {
const res = await this._locate(locator, true);
assertElementExists(res, locator);
const elem = usingFirstElement(res);
const html = await elem.getHTML();
const elems = await this._locate(locator, true);
assertElementExists(elems, locator);
const html = Promise.all(elems.map(async elem => elem.getHTML(false)));
this.debugSection('Grab', html);
return html;
}
Expand Down
8 changes: 4 additions & 4 deletions test/helper/WebDriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ describe('WebDriver', function () {
.then(() => wd.grabSource())
.then(source => assert.notEqual(source.indexOf('<title>TestEd Beta 2.0</title>'), -1, 'Source html should be retrieved')));

it('should grab the source for element', () => wd.amOnPage('/')
it('should grab the innerHTML for an element', () => wd.amOnPage('/')
.then(() => wd.grabHTMLFrom('#area1'))
.then(source => assert.equal(
.then(source => assert.deepEqual(
source,
`<div id="area1" qa-id="test">
[`
<a href="/form/file" qa-id="test" qa-link="test"> Test Link </a>
</div>`,
`],
)));
});

Expand Down