gpt4 book ai didi

automated-tests - 如何在 Robot Framework 中编写循环

转载 作者:行者123 更新时间:2023-12-04 05:11:54 25 4
gpt4 key购买 nike

我做了我的第一个简单的测试用例,但我有一个问题。

是否可以在 Robot Framework 中编写一个循环?

我想从地址和修改后的变量“i”的地址中检索值。我想执行直到存在这样的地址,因为它是表中的一行。

${f1}       A
${f_temp} B

While ${f1} != ${f_temp}
or
While element xpath=//${i} is visible


\ ${F_temp} Get Text xpath=//${i}
\ ${i} ${i}+1
\ Run Keyword And Continue On Failure Should be equal ${f_temp} ${f1}

有任何想法吗?

最佳答案

Robot Framework 没有 while 循环。您必须使用 FOR 循环和“exit for loop if”关键字才能退出。它会在有限的时间内运行,但是如果您在范围内选择了足够大的数字,那么对于实际用途来说,它已经足够接近了。

*** Test Cases ***
For Test
FOR ${i} IN RANGE 999999
Exit For Loop If ${i} == 9
Log ${i}
END
Log Exited

关于automated-tests - 如何在 Robot Framework 中编写循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36328595/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com