这有点像一堵文字墙,但我试图让它尽可能短。
情况:我正在打开一个网站,该网站显示一个任务和一个加载栏。加载栏可以显示 0-100%、完成或停止在 0-100% 的任一数字。想法:我使用“获取文本”来读取加载栏并检查它是“完成”还是“停止”。要忽略百分比,我只想要文本的第一部分(例如仅“停止”)。我用“等待关键字成功”重复关键字,直到文本停止或完成。
编码:
Observe Task
Wait Until Keyword Succeeds 120 min 60 sec Check Progress Status ${task_progress_bar}
Check Progress Status
[Arguments] ${task_progress_bar}
${task_status} = Get Text ${task_progress_bar}
Log to Console \n ${task_status}
@{words} = Split String ${test_string} ${SPACE}
${first_word} = @{words}[1]
Log to Console \n ${first_word}
Log to Console 'this is a test message'
Run Code Online (Sandbox Code Playgroud)
我记录状态以检查它是否有效。确实如此。控制台显示 0%、0%、停止在 0% 等但这是我得到的唯一输出。它既不显示 first_word 变量,也不显示测试消息。它似乎在拆分字符串时中断
我试图解决的问题:
${test_string} Set Variable 'Robot is not working'
Log to Console \n ${test_string}
@{words} = Split String …Run Code Online (Sandbox Code Playgroud)