How to save xpath content / value?

Suppose xpath as shown below:

xpath : //div[@id='cslGridViewPanelControl']/div/div[2]/div/table/tbody/tr/td[2]/table/tbody/tr/td/table/tbody/tr/td/div Last div element contains 'Displaying 1 to 30 of 145300'. I need to store 'Displaying 1 to 30 of 145300' in some variable by using selenium tool. 

I tried

 command target value store xpath variable1 echo ${variable1} 

It appears as variable1: xpath. But I need variable1: "Mapping from 1 to 30 out of 145300." Can anybody help me?

+4
source share
2 answers
 Try storeText ( locator, variableName ) Then use it ${variableName} 

Refer Selenium Documentation for storeText

+3
source

saga told you how to save this line, since you only need to store 145300, below code will help you

 store | Displaying 1 to 30 of 145300 | string store | 1 | delimiter store | javascript{storedVars['string'].split('of')[storedVars['delimiter']]} | result echo | ${result} 
+1
source

All Articles