Nexial Automation

Test Automation Platform for everyone!

X

web » saveAttribute(var,locator,attrName)

Description

This command captures the attribute value of the first element to match specified locator and save it to var. The attribute name is denoted as attrName.

Suppose the following HTML:

<div id="myDiv" data-bind="company.person.name">...</div>

With the following command:
web | saveAttribute(var,locator,attrName) | myVar | css=#myDiv | data-bind

Now the data variable myVar would contain the value company.person.name.

Parameters

  • var - the data variable name to store the attribute values found for the first matching element.
  • locator - locator of the target element.
  • attrName - the target attribute name of the element.

Example

Script:

Output:

See Also