getProperty
The Get Element Property command will return the result of getting a property of an element.
Usage
$(selector).getProperty(property)
Parameters
Name | Type | Details |
---|---|---|
property | String | name of the element property |
Example
- Asynchronous Mode
- Synchronous Mode
getProperty.js
it('should demonstrate the getProperty command', async () => {
var elem = await $('body')
var tag = await elem.getProperty('tagName')
console.log(tag) // outputs: "BODY"
})
getProperty.js
it('should demonstrate the getProperty command', () => {
var elem = $('body')
var tag = elem.getProperty('tagName')
console.log(tag) // outputs: "BODY"
})
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.