Assign text input value to a variable in Calabash

611 views Asked by At

I'm evaluating Calabash coming from an Appium & Selenium background.

In Selenium i can simply assign the .attribute("value") to a variable and then do what I want with it. I'm looking for something similar in Calabash.

Specifically in an Android app (although I am looking for a cross platform solution) I have an EditText that I can query with :text and I can see the value in the output i.e.

irb(main):008:0> query("EditText",:text)
[
    [0] "17512"
]

How can I perform the same function as a step definition in calabash and assign the output (i.e. 17512) to a variable?

Any advice is much appreciated.

1

There are 1 answers

3
YoDK On BEST ANSWER

This post helped me get what I needed: https://sqa.stackexchange.com/questions/8385/how-to-get-the-text-to-verify-for-edittext-in-calabash-android

Particularly actual_email = query("EditText id:'txt_email'", :text).first