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 css=img.responsive-img@href Here "css=img.responsive-img" is element's locator 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.

Update V5.3.3: If the locator is not found, no error is trigged. Instead, the text #LNF is stored in the variable. "#LNF" stands for "Locator not found".

Related forum post(s): How to copy and paste mp3 hyperlink .

For more information about data extraction in general see Web Scraping with Selenium 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@href mylink
storeAttribute css=img.responsive-img@alt myalttext
echo The image links to ${mylink} and its ALT text is ${myalttext}

Works in

UI.Vision RPA for Chrome Selenium IDE, UI.Vision RPA 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.

<em>UI.Vision RPA</em> Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the UI Vision RPA software newsletter . We'll send you updates on new releases that we're working on.