Skip to main content

getProperty

Overview

Use the getProperty command to retrieve a property of an element.

Usage

await browser.$(selector).getProperty(property);

Command Parameters

NameTypeDescription
propertyStringThe name of the element's property.

Usage Examples

it("should demonstrate the getProperty command", async ({ browser }) => {
var elem = await browser.$("body");
var tag = await elem.getProperty("tagName");
console.log(tag); // outputs: "BODY"
});

References

We'd like to give credit to the original WebdriverIO docs article, from which we drew some information while writing our version.