TestRiggor 从元素中获取文本并将其存储到变量中,根据预期文本断言它,然后在文本字段中输入实际测试

问题描述 投票:0回答:1

我想将此“下拉列表”元素的文本获取到变量,根据预期值断言它,然后将其键入文本字段。

enter image description here

open url "https://the-internet.herokuapp.com/dropdown"
click "Dropdown List" heading
save text of element matching "h3" as "actual_text"
save value of element matching "h3" as "actual_value"
check that "actual_value" contains "Dropdown List"

但是,它失败了,请帮忙

*Errors:
Couldn't find element for check that "actual_value" contains "Dropdown List"
open url "https://stackoverflow.com/users/login"
type textfield "email" "actual_text"*

我检查了文档,但没有运气

testrigor
1个回答
0
投票

实现了类似的事情。

open url "https://www.blazedemo.com/"
check that button "Find Flights" is visible
// To get value from Find Flights
grab value from "btn btn-primary" and save it as "variableName"
check that stored value "variableName" itself contains "Find Flights"

另一种方法是

grab value from button to the right of "Remember me" and save as "buttonText"
check that stored value "buttonText" contains "Submit"
© www.soinside.com 2019 - 2024. All rights reserved.