I am trying to get the number 70 from the below mentioned string:
Showing 1 to 50 of 70 entries
I have tried the below code:
${text} = Get Text xpath=//div[@id='DataTables_Table']
Page Should Contain Showing 1 to
${edited_text} = Remove String ${text} Showing 1 to 50 of
But i am getting the below mentioned error:
No keyword with name 'Remove String' found.
I am getting the same error even if I use the following keywords:
Get Substring, Replace String
When keywords aren't found, this typically means that the library has not been loaded. With the exception of the BuiltIn library, all others need to be declared. A full working example of your code is below:
*** Setting ***
Library String
*** Test Cases ***
tc
${text} Set Variable Showing 1 to 50 of 70 entries
${edited_text} Remove String ${text} Showing 1 to 50 of
${matches} String.Get Regexp Matches ${text} [0-9]{1,2}
Log "Max is:" ${matches[2]}
As you're intention is to match the 3rd digit group, the regular expression match seems like the cleanest approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With