我正在运行安卓葫芦测试。我的屏幕上有两个选项卡,当我尝试perform_action("滑动","向右")屏幕的一小部分滑动时,要在这两个选项卡之间切换,它会返回到以前的状态而不切换到新选项卡。我什至尝试过perform_action('drag', 86, 306, 143, 143, 10),但没有得到任何回应。当我打印查询时,得到以下给定的响应。在这里,我想在聊天和联系人之间切换。
{
"id" =>nil,
"enabled" =>true,
"contentDescription" =>nil,
"text" =>"Chats",
"visible" =>true,
"tag" =>nil,
"description" =>"android.support.v7.widget.AppCompatTextView@42569e98",
"class" =>"android.support.v7.widget.AppCompatTextView",
"rect" => {
"center_y" =>157,
"center_x" =>119,
"height" =>29,
"y" =>143,
"width" =>67,
"x" =>86
}
},
{
"id" =>nil,
"enabled" =>true,
"contentDescription" =>nil,
"visible" =>true,
"tag" =>nil,
"description" =>"android.support.design.widget.TabLayout$TabView@4256b740",
"class" =>"android.support.design.widget.TabLayout$TabView",
"rect" => {
"center_y" =>158,
"center_x" =>360,
"height" =>72,
"y" =>122,
"width" =>240,
"x" =>240
}
},
{
"id" =>nil,
"enabled" =>true,
"contentDescription" =>nil,
"text" =>"Contacts",
"visible" =>true,
"tag" =>nil,
"description" =>"android.support.v7.widget.AppCompatTextView@4256c690",
"class" =>"android.support.v7.widget.AppCompatTextView",
"rect" => {
"center_y" =>157,
"center_x" =>359,
"height" =>29,
"y" =>143,
"width" =>107,
"x" =>306
}
这些都是非常古老且已弃用的操作。我建议只使用pan_left
或类似的东西。您可以为这些方法指定百分比坐标
下面的代码 enough.no 需要使用perform_action方法。 Then /^I pan right $/ do
pan_right()
end