Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.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 3D触控应用程序如何实现自动化?_Ios_Automated Tests_Appium_3dtouch_Xcuitest - Fatal编程技术网

iOS 3D触控应用程序如何实现自动化?

iOS 3D触控应用程序如何实现自动化?,ios,automated-tests,appium,3dtouch,xcuitest,Ios,Automated Tests,Appium,3dtouch,Xcuitest,我为我的iOS应用程序编写Appium UI测试。一些测试具有这样的工作流: 应用程序被发送到后台 用户在应用程序图标上进行“强制触摸”,直到出现菜单(快捷方式) 将从此快捷方式启动应用程序 我的环境: 模拟器iOS 13.2 appium 1.15.0 Appium Python客户端0.47 我尝试过这样的代码(Python),它不执行“强制触摸”: (我试图调整坐标,例如(150200),(260400)-没有按下应用程序图标) 我试过AppleScript,但现在我能做的就是激活模拟

我为我的iOS应用程序编写Appium UI测试。一些测试具有这样的工作流:

  • 应用程序被发送到后台
  • 用户在应用程序图标上进行“强制触摸”,直到出现菜单(快捷方式)
  • 将从此快捷方式启动应用程序
  • 我的环境:

    • 模拟器iOS 13.2
    • appium 1.15.0
    • Appium Python客户端0.47
    我尝试过这样的代码(Python),它不执行“强制触摸”:

    (我试图调整坐标,例如(150200),(260400)-没有按下应用程序图标)

    我试过AppleScript,但现在我能做的就是激活模拟器应用程序。:)

    我发现了什么,但它不起作用:

    :在本文中,“press”命令与“element”=AppName一起使用,但我的selenium驱动程序说“press”需要“x”、“y”,而不是“element”

    :在本文中,使用了
    driver.executeScript(“mobile:touch:tap”,parms)
    ,但我的驱动程序说没有命令“mobile:touch:tap”:

    例如,我看过XUITestDriver文档/代码,但看不到任何与3D触摸相关的东西

    你知道吗:
    1.如何在iOS模拟器中自动化3D触摸应用程序图标
    2.如何检查XCUITest驱动程序是否支持它
    3.它能像AppleScript一样通过smth实现自动化吗

    提前感谢:)

    如果你是说喜欢,你可以像下面那样打开它。 (Ruby代码)

    #长按带有W3C操作的“联系人”图标
    el=@driver.find_元素:名称“联系人”
    action\u builder=@driver.action
    动作构建器。移动到(el)
    .指针向下(:左)
    .pause(操作构建器指针输入[0],2)
    .指针向上(:左)。执行
    
    这就是API。 你也可以找到Python

    (iOS 13不提供“3D触控”。该功能采用长按方式)

    self.driver.background_app(-1) # this works: sends an app to backround
    args = {'duration': 5, 'x': 200, 'y': 200}
    self.driver.execute_script("mobile:touchAndHold", args) # this doesn't work: force touch on Home screen
    
    selenium.common.exceptions.WebDriverException: Message: Unknown mobile command 'touch:tap'. Only scroll, swipe, pinch, doubleTap, twoFingerTap, touchAndHold, tap, dragFromToForDuration, selectPickerWheelValue, alert, setPasteboard, getPasteboard, source, getContexts, installApp, isAppInstalled, removeApp, launchApp, terminateApp, queryAppState, activateApp, viewportScreenshot, startPerfRecord, stopPerfRecord, installCertificate, startLogsBroadcast, stopLogsBroadcast, batteryInfo, deviceInfo, activeAppInfo, pressButton, enrollBiometric, sendBiometricMatch, isBiometricEnrolled, clearKeychains, getPermission, siriCommand commands are supported.