@luminati-io/webdriverio8
Version:
Next-gen browser and mobile automation test framework for Node.js
33 lines (31 loc) • 1.41 kB
JavaScript
/**
*
* Will return true or false whether or not an `<option>` or `<input>` element of type
* checkbox or radio is currently selected.
*
* <example>
:index.html
<select name="selectbox" id="selectbox">
<option value="John Doe">John Doe</option>
<option value="Layla Terry" selected="selected">Layla Terry</option>
<option value="Bill Gilbert">Bill Gilbert"</option>
</select>
:isSelected.js
it('should detect if an element is selected', async () => {
let element = await $('[value="Layla Terry"]');
console.log(await element.isSelected()); // outputs: true
element = await $('[value="Bill Gilbert"]')
console.log(await element.isSelected()); // outputs: false
});
* </example>
*
* @alias element.isSelected
* @return {Boolean} true if element is selected
* @uses protocol/elements, protocol/elementIdSelected
* @type state
*
*/
export function isSelected() {
return this.isElementSelected(this.elementId);
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNTZWxlY3RlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21tYW5kcy9lbGVtZW50L2lzU2VsZWN0ZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0E0Qkc7QUFDSCxNQUFNLFVBQVUsVUFBVTtJQUN0QixPQUFPLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7QUFDakQsQ0FBQyJ9