.getProperty() Suggest edits
Since: 3.0.0Retrieve the value of a specified DOM property for the given element. For all the available DOM element properties, consult the Element doc at MDN.
For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.
Usage
browser.element(selector).getProperty(name)
Example
export default {
demoTest(browser) {
const result = browser.element('#login input[type=text]').getProperty('classList');
console.log('classList', result);
},
async demoTestAsync(browser) {
const result = await browser.element('#login input[type=text]').getProperty('classList');
console.log('classList', result);
}
}
import { NightwatchBrowser } from 'nightwatch';
export default {
demoTest(browser: NightwatchAPI): void {
const result = browser.element('#login input[type=text]').getProperty('classList');
console.log('classList', result);
},
async demoTestAsync(browser: NightwatchAPI): Promise<void> {
const result = await browser.element('#login input[type=text]').getProperty('classList');
console.log('classList', result);
}
}
Parameters
Name | Type | description |
---|---|---|
name |
string | element property |
Returns
Type | description |
---|---|
ScopedValue<string> |