storeText (target, pattern) - Selenium IDE command

The storeText command in the Selenium IDE software testing tool is useful to store the text value of page element in to variable for future use. So it the recommended command for web scraping information from HTML text and tables.

Note that for input boxes, select boxes, checkboxes, radiobuttons or textareas the text that you see is technically the field value. So storeText does not work on these elements by design, it returns "". Instead, use storeValue to extract text from input elements.

If you need the extract text from the HTML source code directly use sourceExtract.

Screencast: Web scraping with storeText:

Jump to the end of the video to see the extracted data in the CSV file. The related forum post is Web scraping with Kantu.

storeText Example

Command Target Pattern/Text
open https://a9t9.com/
storeText //*[@id="content"]/div[2]/div/h2[1] name
echo Name var = ${name}

Works in

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

Related Demo Macros

DemoStoreEval

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

Related commands: storeTextPresent, verifyTextPresent

The "storeTextPresent" command is not for storing value of any target element, but could be used to verify that specified target text is available on the page or not. The Kantu IDE does not support storeTextPresent (and verifyTextPresent) because we want to help reduce the zoo of previous IDE commands.

In the modern Kantu IDE storeTextPresent and verifyTextPresent can be easily recreated with storeText plus if (${var}" = "text to check"). The table below shows an example: It "simulates" storeTextPresent by using storeText and then checks the variable if the text is correct. If not, it throws an error.

Command Target Pattern/Text
open https://a9t9.com/kantu/demo/storeeval
storeText css=#content > div.row > div > h2:nth-child(4) myvar
if "${myvar}" = "Catch Javascript alerts"
throwError text NOT found on website
endIf

See also

storeEval, 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.