testrigor

TestRiggor get Text from an Element and store it to a variabe assert it against expected text , and enter the actual test to a text field


I want to get the text of this "Dropdown List" element to a variable, assert it against expected value and then type it to a text field.

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"

However ,it fails with please help

*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"*

I checked the documentation but no luck


Solution

  • A similar thing is achieved.

    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"
    

    Another way is

    grab value from button to the right of "Remember me" and save as "buttonText"
    check that stored value "buttonText" contains "Submit"