Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium 没有名称为';移除字符串';建立_Selenium_Robotframework - Fatal编程技术网

Selenium 没有名称为';移除字符串';建立

Selenium 没有名称为';移除字符串';建立,selenium,robotframework,Selenium,Robotframework,我正在尝试从下面提到的字符串中获取数字70: 显示70个条目中的1到50个 我尝试了以下代码: ${text} = Get Text xpath=//div[@id='DataTables_Table'] Page Should Contain Showing 1 to ${edited_text} = Remove String ${text} Showing 1 to 50 of 但是我得到了下面提到的错误: 找不到名为“删除字符串”的关键字 即使使用以下关键字,我也会遇到相同的错误: 获

我正在尝试从下面提到的字符串中获取数字70:

显示70个条目中的1到50个

我尝试了以下代码:

${text} = Get Text xpath=//div[@id='DataTables_Table']
Page Should Contain Showing 1 to
${edited_text} = Remove String ${text} Showing 1 to 50 of
但是我得到了下面提到的错误:

找不到名为“删除字符串”的关键字

即使使用以下关键字,我也会遇到相同的错误:

获取子字符串,替换字符串


如果找不到关键字,这通常意味着库尚未加载。除了
内置库
之外,所有其他库都需要声明。下面是代码的完整工作示例:

*** 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]}

由于您打算匹配第三个数字组,正则表达式匹配似乎是最干净的方法。

当找不到关键字时,这通常意味着库尚未加载。除了
内置库
之外,所有其他库都需要声明。下面是代码的完整工作示例:

*** 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]}

由于您打算匹配第三个数字组,正则表达式匹配似乎是最干净的方法。

这是HTML代码?这是HTML代码?嗨A.Kootstra谢谢您的建议它对我有用:)嗨A.Kootstra谢谢您的建议它对我有用:)