parent
4f26a73584
commit
7d0d8bfe33
@ -1 +1,4 @@ |
||||
NODE_OPTIONS=--max-old-space-size=3072 |
||||
NODE_OPTIONS=--max-old-space-size=3072 |
||||
gist_token = <token> |
||||
account_passphrase = <passphrase> |
||||
account_password = <password> |
@ -0,0 +1,30 @@ |
||||
const EventEmitter = require('events') |
||||
|
||||
class clearEditablecontent extends EventEmitter { |
||||
command (cssSelector) { |
||||
this.api.perform((done) => { |
||||
clearContent(this.api, cssSelector, () => { |
||||
done() |
||||
this.emit('complete') |
||||
}) |
||||
}) |
||||
return this |
||||
} |
||||
} |
||||
|
||||
function clearContent (browser, cssSelector, callback) { |
||||
browser.execute(function (cssSelector) { |
||||
const selection = window.getSelection() |
||||
const range = document.createRange() |
||||
|
||||
range.selectNodeContents(document.querySelector(cssSelector)) |
||||
selection.removeAllRanges() |
||||
selection.addRange(range) |
||||
}, [cssSelector], function () { |
||||
browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE) |
||||
.pause(5000) |
||||
callback() |
||||
}) |
||||
} |
||||
|
||||
module.exports = clearEditablecontent |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue