UNPKG

@luminati-io/webdriverio8

Version:

Next-gen browser and mobile automation test framework for Node.js

30 lines 1.45 kB
/** * * Get an attribute from a DOM-element based on the attribute name. * * <example> :index.html <form action="/submit" method="post" class="loginForm"> <input type="text" name="name" placeholder="username"></input> <input type="text" name="password" placeholder="password"></input> <input type="submit" name="submit" value="submit"></input> </form> :getAttribute.js it('should demonstrate the getAttribute command', async () => { const form = await $('form') const attr = await form.getAttribute('method') console.log(attr) // outputs: "post" }) * </example> * * @alias element.getAttribute * @param {string} attributeName requested attribute * @return {String|null} The value of the attribute, or null if it is not set on the element. * @uses protocol/elements, protocol/elementIdAttribute * @type property * */ export function getAttribute(attributeName) { return this.getElementAttribute(this.elementId, attributeName); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0QXR0cmlidXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbW1hbmRzL2VsZW1lbnQvZ2V0QXR0cmlidXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBeUJHO0FBQ0gsTUFBTSxVQUFVLFlBQVksQ0FFeEIsYUFBcUI7SUFFckIsT0FBTyxJQUFJLENBQUMsbUJBQW1CLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxhQUFhLENBQUMsQ0FBQTtBQUNsRSxDQUFDIn0=