为了帮助te测试社区了解测试工具的差异,我尝试创建一个范围,就像Flur Funk对Tosca所做的那样。 (我曾在项目中x次使用Tosca)
现在我用机器人框架解决了同样的难题。 (稍后我会把它们放到Youtube上)
因此,我遇到了一个难题: 到目前为止,我得到的是:
*** Settings ***
# https://robotframework-browser.org/
Library Browser
Library DateTime
Library Collections
Library String
#Library SeleniumLibrary
#Library SeleniumLibrary
# https://robotframework.org/robotframework/latest/libraries/DateTime.html
# pip install DateTime
*** Variables ***
@{VALUES} | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
*** Test Cases ***
Example Test 73589
Browser.Open Browser https://obstaclecourse.tricentis.com/Obstacles/73589
${rijmetgetallen}= GET TEXT id=array
LOG TO CONSOLE ${rijmetgetallen}
${stripped}= STRIP STRING ${rijmetgetallen} characters=[,\'n]
${converted}= CONVERT TO LIST ${stripped}
FOR ${var} IN ${stripped}
Run Keyword If '${var}' == '1' Continue For Loop
Click id=b1
LOG TO CONSOLE ${var}
# ELSE Click id=tech
END
Click id=button1
Click id=button2
Get Text xpath=//body *= You solved this automation problem.
# used resources:
# https://www.tutorialspoint.com/robot_framework/robot_framework_working_with_variables.htm
这将导致日志:
Example Test 73589 3
2
5
1
9
4
8
6
7
| FAIL |
Evaluating expression ''3
2
5
1
9
4
8
6
7' == '1'' failed: SyntaxError: EOL while scanning string literal (<string>, line 1)
------------------------------------------------------------------------------
0012 Test 73589 | FAIL |
你将如何解决这个问题? 如何克服错误
Tosca工具的解决方案可以在这里找到:https://www.youtube.com/watch?v=BcsuH8Q1x60
这里有一个解决方案——别忘了在视频中记下我的名字;)
它使用SeleniumLibrary,包括xpath和;css选择器,用于&;IF块和直接变量访问(
$var
vs${var}
)有一个角落的情况会使它无法工作-把这个留给你;)
相关问题 更多 >
编程相关推荐