简体   繁体   English

允许 Appium Desktop 和 Appium Inspector 连接到 Xcode iOS 模拟器的问题

[英]Issues allowing Appium Desktop and Appium Inspector connect to Xcode iOS simulator

I was trying to set up Appium to automate iOS app actions on an Xcode iPhone 8 simulator.我试图设置 Appium 以在 Xcode iPhone 8 模拟器上自动执行 iOS 应用程序操作。 I was unsure of how to allow the Appium desktop server to interact with the simulator.我不确定如何让 Appium 桌面服务器与模拟器交互。 I saw that I had to set certain capabilities and based on some tutorials, I set platformName, platformVersion, deviceName, but when I tried to set "app" capability, it said that it could only be set to.app files.我看到我必须设置某些功能,根据一些教程,我设置了 platformName、platformVersion、deviceName,但是当我尝试设置“app”功能时,它说只能设置为 .app 文件。 My app is an xcodeproj, and I was wondering if it was possible to use it as is?我的应用程序是一个 xcodeproj,我想知道是否可以按原样使用它? Also, I was wondering how to allow appium to interact with built-in iOS apps, such as calendar, clock etc because I don't have the app files for those apps.另外,我想知道如何让 appium 与内置的 iOS 应用程序交互,例如日历、时钟等,因为我没有这些应用程序的应用程序文件。 Does the desiredCapabilities for appium have to be set to a.app file, or can I also use appium to interact with the iphone simulator itself? appium 的 desiredCapabilities 是否必须设置为 a.app 文件,或者我是否也可以使用 appium 与 iphone 模拟器本身进行交互?

Through the appium inspector, I have set platformName to "iOS", platformVersion to "15.5", deviceName to "iPhone 8", but I can't set the path to an.app file because my app is an xcodeproj.通过 appium inspector,我已经将 platformName 设置为“iOS”,platformVersion 设置为“15.5”,deviceName 设置为“iPhone 8”,但我无法设置 an.app 文件的路径,因为我的应用程序是 xcodeproj。

enter code here 

1.No need to Set app path. 1.无需设置应用路径。

2.Build your app xcodeproject and also install your simulator. 2.构建您的应用程序 xcodeproject 并安装您的模拟器。

DesiredCapabilities capabilities = new DesiredCapabilities(); DesiredCapabilities 能力 = 新的 DesiredCapabilities(); capabilities.setCapability("platformName",("platformName"));能力.setCapability(“平台名称”,(“平台名称”));

    capabilities.setCapability("deviceName", ("deviceName"));

    capabilities.setCapability("platformVersion"("platformVersion"));

    capabilities.setCapability("bundleId",("bundleId"));

    capabilities.setCapability("udId",("udId"));

    capabilities.setCapability("deviceOrientation", "portrait");

    capabilities.setCapability("automationName", "XCUITest");

    driver = new IOSDriver<WebElement>(url, capabilities);

enter code here在此处输入代码

I Give Java code我给Java码

deviceName=iphone 7 black deviceName=iphone 7 黑色

udid =6d01f0eb40c1956f6fe0ebeeabd83a8e0***** udid =6d01f0eb40c1956f6fe0ebeeabd83a8e0*****

platformName =iOS平台名称 =iOS

platformVersion=15.3.1平台版本=15.3.1

appPackage=Give Your appPacakge Name appPackage=给你的appPackage名称

launcherActivity=Give Your Appactivity name or LauncherACtivityName launcherActivity=提供您的应用活动名称或 LauncherACtivityName

url=http://127.0.0.1:4723/wd/hub url=http://127.0.0.1:4723/wd/hub

bundleId=Give Your APP BundleID bundleId=给你的APP BundleID

Yes, you can interact with a simulator with Appium.是的,您可以使用 Appium 与模拟器进行交互。 Moreover, you can only install files with the extension .app on the simulator, you can't install.ipa You can copy your APP file in any place, an app stored in the Products catalog而且在模拟器上只能安装扩展名为.app的文件,不能安装.ipa 可以在任何地方复制你的APP文件,一个app存放在Products目录下

    **Simulator YAML:**
  platformName: 'ios'
  deviceName: 'iPhone 11'
  automationName: 'XCUITest'
  platformVersion: '15.2'
  udid: 'simualtor UDID'
  bundleId: 'your bundle id'
  systemPort: '4723'
  autoAcceptAlerts: 'true'
  unicodeKeyboard: 'true'
  resetKeyboard: 'true'
  fullReset: 'false'
  locale: 'en'
  language: 'en'
  keepKeyChains: 'false'
  acceptInsecureCerts: 'true'
  --relaxed-security: 'true'

{
 “deviceName”: “iPhone”,
 “platformVersion”: “15.6",
 “platformName”: “iOS”,
 “udid”: “simulator/device UDID”,
 “app”: “path to file”,
 “automationName”: “XCUITest”,
 “noReset”: true
}
  1. You will need to generate a.app file for Appium to have it install automatically.您需要为 Appium 生成一个 .app 文件以使其自动安装。 If you don't want to generate.app file, and instead want to install it directly on the device (through your xcodeproj), then in that case you may not use "app" capability.如果您不想生成 .app 文件,而是想将其直接安装在设备上(通过您的 xcodeproj),那么在这种情况下您可能不会使用“app”功能。 Instead, you can supply bundleId capability and provide the bundle ID of the app as the value.相反,您可以提供 bundleId 功能并提供应用程序的捆绑包 ID 作为值。 Appium will then skip the installation and instead launch your already installed app.然后 Appium 将跳过安装,而是启动您已经安装的应用程序。

  2. You can certainly use Appium to automate the IOS systems app like calculator, clock, etc. You will need to supply the bundle ID of whatever app you can to interact with.您当然可以使用 Appium 来自动化 IOS 系统应用程序,例如计算器、时钟等。您需要提供可以与之交互的任何应用程序的包 ID。 You can get the bundle Ids from here: https://support.apple.com/en-in/guide/deployment/depece748c41/web您可以从此处获取捆绑 ID:https: //support.apple.com/en-in/guide/deployment/depece748c41/web

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

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