Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No keyword with name 'Remove String' found

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

like image 304
Tharak Sarvayoni Avatar asked Dec 13 '25 06:12

Tharak Sarvayoni


1 Answers

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.

like image 134
A. Kootstra Avatar answered Dec 15 '25 15:12

A. Kootstra