remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
remix-project/apps/remix-ide/test-browser/commands/clickElementAtPosition.js

24 lines
587 B

const EventEmitter = require('events')
class ClickElement extends EventEmitter {
command (cssSelector, index = 0) {
this.api.perform((done) => {
_clickElement(this.api, cssSelector, index, () => {
done()
this.emit('complete')
})
})
return this
}
}
function _clickElement (browser, cssSelector, index, cb) {
browser.waitForElementPresent(cssSelector)
.execute(function (cssSelector, index) {
document.querySelectorAll(cssSelector)[index].click()
}, [cssSelector, index], function () {
cb()
})
}
module.exports = ClickElement