我正在使用 calabash-android测试我的应用程序。在其pre-defined steps它有一堆“等待”步骤,但只有“然后我等待带有 id 的 View 出现”。
我需要等待字符串 R.string.final_result
出现。
我想知道,我怎样才能等待带有 id 的字符串出现?我需要等待字符串资源的 ID,因为字符串可以在我的应用程序中本地化。
如果无法使用预定义的步骤,我该如何创建一个步骤来完成它?
最佳答案
鳍 您可以先使用 wait_poll 方法等待元素。一旦它出现,您就可以获得它的文本值。因为该字符串将作为元素的属性值之一。查看.feature文件的代码
Then I should wait for the text Final Result
以及您的 .rb 文件中的代码,
Then(/^I should wait for the text Final Result$/) do
#this wait_poll method will wait untill element with specified id exists.
wait_poll(:until_exists => "* marked:'#{id}'", :timeout => 20)do
#code, you can run while waiting
end
end
关于android - calabash-android:WAITING带有 id 的字符串出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39243465/