4

假设 xpath 如下:

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.

我试过了

command    target           value 
 store      xpath           variable1
 echo      ${variable1}

它显示为变量 1:xpath。但我需要变量 1:“显示 145300 的 1 到 30”。谁能帮帮我?

4

2 回答 2

3
Try storeText ( locator, variableName )
Then use it ${variableName}

有关 storeText,请参阅Selenium 文档

于 2012-06-13T08:53:49.437 回答
2

saga 告诉你如何存储那个字符串,因为你只需要存储 145300,下面的代码会帮助你

store   |  Displaying 1 to 30 of 145300  |  string
store   | 1 |  delimiter
store   | javascript{storedVars['string'].split('of')[storedVars['delimiter']]}  |  result
echo    | ${result}
于 2012-06-16T08:49:53.777 回答