.isSelected() Suggest edits
Since: 3.5.0Determines if an element is selected.
For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.
For more info on the new browser.element.find()
syntax, refer to the new Element API Overview page.
Usage
browser.element.find(selector).isSelected()
Example
describe('isSelected Demo', function() {
it('test isSelected', function(browser) {
browser.element.find('#search')
.isSelected()
.assert.equals(true);
});
it('test async isSelected', async function(browser) {
const result = await browser.element.find('#search').isSelected();
browser.assert.equal(result, true);
});
});
Returns
Type | description |
---|---|
ScopedValue<boolean> |