storeAttribute (locator@attribute, variable) - Selenium IDE command

The storeAttribute stores the attribute value of specified element into a given variable. You can store any attribute's value using the "storeAttribute" command. The input is the usual locator for the element followed by an @ sign and then the name of the attribute in target column of selenium IDE. For example a@href Here "a" is element's node name and "href " is attribute name which we want to store.

storeAttribute does not work with input boxes. But for this, you can use storeEval | window.document.getElementsByName('Phone')[0].value; | value as replacement. This does the same as storeValue in the old IDE.

storeAttribute Example

The example extracts the link and the ALT text from an image.

Command Target Pattern/Text
open https:/
storeAttribute css=img.responsive-img@src mylink
storeAttribute css=img.responsive-img@alt myalttext
echo The image links to ${mylink} and its ALT text is ${myalttext}

Works in

Kantu for Chrome Selenium IDE, Kantu for Firefox Selenium IDE, Firefox IDE Classic

Related Demo Macros

DemoExtract, DemoStoreEval

The ready-to-import-and-run source code of all demo macros can be found in the Github repository testmacros folder.

See also

storeEval, storeText, storetitle, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.

Anything wrong or missing on this page? Suggestions?

...then please contact us.

Kantu Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.