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/getAddressAtPosition.js

28 lines
772 B

const EventEmitter = require('events')
class GetAddressAtPosition extends EventEmitter {
command (index, cb) {
this.api.perform((done) => {
getAddressAtPosition(this.api, index, (pos) => {
done()
cb(pos)
this.emit('complete')
})
})
return this
}
}
function getAddressAtPosition (browser, index, callback) {
browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]')
.execute(function (index) {
const deployedContracts = document.querySelectorAll('*[data-shared="universalDappUiInstance"]')
const id = deployedContracts[index].getAttribute('id')
return id.replace('instance', '')
}, [index], function (result) {
callback(result.value)
})
}
module.exports = GetAddressAtPosition