简体   繁体   English

Appium :: TouchAction.new.tap无法正常工作

[英]Appium::TouchAction.new.tap doesn't work correctly

And(/^I click OK button in popup$/) do
  #Appium::TouchAction.new.tap(x:0.64, y:0.57, count: 1).perform
  Appium::TouchAction.new.tap(x: 270, y: 506,count: 1).perform
end

And(/^I click Allow button in popup$/) do
  #Appium::TouchAction.new.tap(x:0.64, y:0.57, count: 1).perform
  Appium::TouchAction.new.tap(x: 270, y: 506,count: 1).perform 
end

Given the next code, I work with Appium 1.9.1, Ruby 2.3.7 and Cucumber to automate iOS app, if I'm passing relative coordinates (percentage) - then appium doesn't perform any taps, but, if I comment out lines with absolute coordinates and comment lines with relative coordinates - all taps will work. 给定下一个代码,如果我传递相对坐标(百分比),则我将与Appium 1.9.1,Ruby 2.3.7和Cucumber一起使iOS应用程序自动化-appium不会执行任何点击,但是,如果我注释掉了具有绝对坐标的直线和具有相对坐标的注释线-所有轻按都将起作用。 The strangest thing is that if I use relative coordinates in 1st line and absolute coordinates in second line - it will perform first tap, but won't perform second. 最奇怪的是,如果我在第一行中使用相对坐标,在第二行中使用绝对坐标,则它将执行第一次点击,但不会执行第二次。 My goal is to use relative coordinates everywhere, so tests will be usable on devices with any screen resolution, please advice, if there are any known solutions to use relative coordinates (or if I'm doing smth wrong) 我的目标是在任何地方都使用相对坐标,因此如果有任何已知的解决方案可以使用相对坐标(或者我做错了),则可以在具有任何屏幕分辨率的设备上使用测试,

After going through your code snippet, I assume you are dealing with alert pop-up in iOS device. 看完您的代码段后,我假设您正在处理iOS设备中的警报弹出窗口。

In iOS, with Appium Java client, I can deal with pop-up using traditional driver.switchTo().alert(); 在iOS中,使用Appium Java客户端,我可以使用传统的driver.switchTo().alert();处理弹出窗口driver.switchTo().alert(); .

Here driver refers to IOSDriver . 这里的driver是指IOSDriver

I'm sure there must be equivalent to this in Ruby as well. 我确定Ruby中也必须有与此等效的功能。

Try using Alert class to accept the alerts instead of tapping on the coordinates. 尝试使用Alert类来接受警报,而不是点击坐标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM