grunt-html-dom-snapshot
Version:
Takes snapshots of the HTML markup on web pages - their immediate DOM content - and screenshots of their viewport - how they look like.
23 lines (19 loc) • 628 B
JavaScript
const { checkSingleElement } = require('./utils/elements')
module.exports = {
detect: function (command) {
return !!command.setValue
},
perform: async function (grunt, target, client, command, options) {
const setValue = command.setValue
const selector = setValue.selector
const value = setValue.value
grunt.output.writeln('Set value of "' + selector +
'" to "' + value + '".')
if (options.singleElementSelections) {
await checkSingleElement(client, selector)
}
return client.$(selector)
.then(element => element.setValue(value))
}
}