Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 葫芦安卓|断言单选按钮自定义步骤帮助_Android_Calabash_Calabash Android - Fatal编程技术网

Android 葫芦安卓|断言单选按钮自定义步骤帮助

Android 葫芦安卓|断言单选按钮自定义步骤帮助,android,calabash,calabash-android,Android,Calabash,Calabash Android,我试图在xamarin窗体上的radiobutton上执行按下事件。单选按钮的索引为0到5 如果我运行query(“RadioButton”,:contentDescription)这将返回6个RadioButton(索引为0到5)。单选按钮没有唯一的文本,因为它们属于一组两个按钮,因此这里的索引值2到5是组RadioGroup的子项,所有按钮的文本标签都相同 我想做的是在radioButton上设置一个带有特定索引的按下事件 在功能文件中,我有:然后我按单选按钮0 我创建了一个名为单选按钮\u

我试图在xamarin窗体上的radiobutton上执行按下事件。单选按钮的索引为0到5

如果我运行
query(“RadioButton”,:contentDescription)
这将返回6个RadioButton(索引为0到5)。单选按钮没有唯一的文本,因为它们属于一组两个按钮,因此这里的索引值2到5是组RadioGroup的子项,所有按钮的文本标签都相同

我想做的是在radioButton上设置一个带有特定索引的按下事件

在功能文件中,我有:然后我按单选按钮0

我创建了一个名为
单选按钮\u steps.rb的自定义步骤定义,并将其保存到默认的葫芦android步骤定义文件夹中

<driveLetter>:\Ruby193\lib\ruby\gems\1.9.1\gems\calabash-android-0.5.8\lib\calabash-android\steps
结果是:

Then(/^I press RadioButton number (\d+)$/) do |arg1|
  pending # express the regexp above with the code you wish you had
end
我试图在功能文件中使用双引号、单引号或不带引号放置索引值,但仍然得到错误。现在我完全迷路了


有人有什么想法吗?

在查询中,您使用如下索引 查询(“RadioButton索引:0”)

步骤def中的方法如下所示

tap_when_element_exists("RadioButton index:#{arg1}")
编辑:对不起,我重读了你的问题,以前我没有回答。 要使您的then步骤正常工作,您需要有一个包含该行的功能文件

Then I press RadioButton number 1

看起来你已经试过了,所以这不是问题所在。实际的错误是calabash看不到您编写的步骤定义。葫芦使用cucumber,这是处理场景和步骤定义等的位。cucumber在项目的“features”目录中的任意位置查找步骤定义。如果您在此处创建一个文件并将步骤定义放入其中,那么它应该可供您的测试运行使用。

嗨,Alan,tap\u when\u element\u exists方法是在给定的语法块中还是在then语法块中?或者两者都有?@GraemePhillips你过得怎么样?@Alanniols我说了谢谢,但没有投票赞成答案,我的感谢被删除了。不管怎样,我现在已经投了赞成票。
Then I press RadioButton number 1