Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.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
Ios 拖放滑块处理程序以滚动轨迹_Ios_Ruby_Ui Automation_Calabash_Calabash Ios - Fatal编程技术网

Ios 拖放滑块处理程序以滚动轨迹

Ios 拖放滑块处理程序以滚动轨迹,ios,ruby,ui-automation,calabash,calabash-ios,Ios,Ruby,Ui Automation,Calabash,Calabash Ios,我需要测试媒体播放器的功能。这不会有任何问题,但我不知道如何拖放滑块处理程序来更改当前的曲目播放位置 我尝试了函数将\u滑块\u值\u更改为,但它对我不起作用 当我执行查询“slider”时,它返回一个空集;当我执行查询“GFSliderView”时,它返回: irb(main):014:0> query "GFSliderView" [ [0] { "class" => "GFSliderView", "id" =>

我需要测试媒体播放器的功能。这不会有任何问题,但我不知道如何拖放滑块处理程序来更改当前的曲目播放位置

我尝试了函数
将\u滑块\u值\u更改为
,但它对我不起作用

当我执行
查询“slider”
时,它返回一个空集;当我执行
查询“GFSliderView”
时,它返回:

irb(main):014:0> query "GFSliderView"
[
  [0] {
            "class" => "GFSliderView",
               "id" => nil,
             "rect" => {
          "center_x" => 160,
                 "y" => 73,
             "width" => 176,
                 "x" => 72,
          "center_y" => 81.5,
            "height" => 17
      },
         "frame" => {
               "y" => 9,
           "width" => 176,
               "x" => 72,
          "height" => 17
      },
            "label" => nil,
      "description" => "<GFSliderView: 0x1280db60; frame = (72 9; 176 17); autoresize = W+TM+BM; layer = <CALayer: 0x1280da90>>"
  }
]
irb(main):014:0>查询“GFSliderView”
[
[0] {
“类”=>“GFSliderView”,
“id”=>nil,
“rect”=>{
“中心x”=>160,
“y”=>73,
“宽度”=>176,
“x”=>72,
“中心y”=>81.5,
“高度”=>17
},
“帧”=>{
“y”=>9,
“宽度”=>176,
“x”=>72,
“高度”=>17
},
“标签”=>零,
“说明”=>“”
}
]
有没有什么方法可以像葫芦安卓在iOS上的
拖动
拖动坐标
那样

我尝试过以下命令:

send_uia_command:command=>“dragFromToForDuration({startOffset:{from},endOffset:{to},duration:4});”

(其中
from
是滑块处理程序的实际位置,
to
from
,且
中心x
值增加)

uia('target.mainWindow().sliders()[0].dragToValue(0.5);'))

将滑块值更改为“SliderHandle.png”,0.2

map(“GFSliderView”,:changesloider,0.2)

(也尝试使用其他值,如10、0.8或100)

它们都不起作用——其中一些导致了模拟器中应用程序的崩溃,一些只是让控制台卡住了


我对葫芦的使用不是很在行(我已经用了将近两个月了),我对应用程序开发和UIA命令一无所知,所以我可能犯了一些愚蠢的错误。

我终于找到了解决方案。 我只是以错误的方式使用了方法
dragFromToForDuration

现在我执行以下命令:

uia("target.dragFromToForDuration({x:'#{start_x}', y:'#{start_y}'}, {x:'#{end_x}', y:'#{end_y}'}, 2)")
(其中
start\u x
start\u y
是起点的坐标,
end\u x
end\u y
显示拖动应结束的位置)。这对我来说非常有效


我决定将它发布在这里,以帮助人们快速找到解决方案,而不是像我那样犯愚蠢的错误:)

我将方法更改为
uia
,因为
send\u uia\u命令
已被弃用。