【问题标题】:Tosca puzzle 41036 solved with RBFW (title: TABLE SEARCH) : code isseu= Strip string does not strip all the charactersTosca 谜题 41036 用 RBFW 解决(标题:TABLE SEARCH):code isseu= Strip string does not strip all the characters
【发布时间】:2021-11-21 07:23:27
【问题描述】:

代码问题与页面有关:https://obstaclecourse.tricentis.com/Obstacles/41036

我目前使用的代码是:

*** Settings ***
Library    Browser
Library    String
# title = TABLE SEARCH

*** Variables ***

*** Test Cases ***
Example Test 70310
    OPEN BROWSER  https://obstaclecourse.tricentis.com/Obstacles/41036
    ${txt}=    GET TEXT    //span[contains(text(),'Table contains')]
    #&{tostring}=  CONVERT TO STRING    ${txt}
    # don't forget the spacebar
    ${endresult}=    String.STRIP STRING        ${txt}   characters=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop"?() /
    LOG TO CONSOLE    ${endresult}  
    FILL TEXT    xpath=//input[@id='resulttext']    ${endresult}
    #${text}=    GET TEXT    id=randomTable
    #LOG TO CONSOLE    ${text}
    Get Text         xpath=//body    *=   You solved this automation problem.
    # used resources

问题是将其简化为:包含“15”? (真/假(我不知道为什么会这样)

起初我以为我错过了空格键,所以我添加了那个,但它没有给出正确的最终结果。

【问题讨论】:

  • 提示:您应该使用正则表达式来查找号码;提示 2:您应该在输入中输入单词“True”或“False”,而不是数字。

标签: string robotframework strip


【解决方案1】:

问题是将其简化为:tains “15”? (真/假(我不知道为什么会这样)

您的原始字符串是“表包含“15”?(真/假)”

您明确要求机器人从字符串中删除characters 中的字符。因此,它将从左侧删除“T”、“a”、“b”、“l”、“e”、“”、“c”、“o”和“n”,以及“e” "、" "、"("、"T"、"r"、"u"、"e"、"/"、"F"、"a"、"l"、"s"、"e" 和")",因为这些都是 characters 参数中的所有字符。

【讨论】:

  • aaaaaah 现在我明白了,“qrstuvwxyz”不知何故消失了。
猜你喜欢
  • 2022-12-01
  • 2021-11-21
  • 2020-01-01
  • 2021-11-17
  • 2021-02-16
  • 2011-08-21
  • 2022-12-27
  • 2012-07-01
  • 2021-04-06
相关资源
最近更新 更多