当前位置: 首页 > 知识库问答 >
问题:

错误:浏览器名称不能与bundleId功能一起设置-Appium-iOS

傅峰
2023-03-14

我正在使用appium自动化iOS应用程序。为了开始申请,我提供了以下能力。

DesiredCapabilities caps = null;
caps = DesiredCapabilities.iphone();
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 5s");
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "IOS");
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.2.6");
caps.setCapability("newCommandTimeout", 2500);
caps.setCapability(MobileCapabilityType.NO_RESET, true);
caps.setCapability("udid", ebf79af8d3777b13fdfd9fc190424fdbfa869af9);
caps.setCapability(IOSMobileCapabilityType.AUTO_ACCEPT_ALERTS, true);        
caps.setCapability(IOSMobileCapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, true);
caps.setCapability("autoAcceptAlerts", true);
caps.setCapability("bundleId", "XXX.XXX.XXX.XXXX");
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");

iOSDriver = new AppiumDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);

该脚本在模拟器上运行良好,将bundle id替换为app功能。

在我的真实设备中,我已经安装了应用程序,我不想给出应用程序路径。因此,我使用bundle id启动应用程序。但是,我们无法启动。我没有给出browserName,但仍在使用它。从哪里采摘?你能帮我找出这个问题吗?

这里是appium日志为真正的设备运行

[BaseDriver] The capabilities ["platform","unexpectedAlertBehaviour","version"] are not standard capabilities and should have an extension prefix
[Appium] Creating new XCUITestDriver (v2.94.2) session
[Appium] Capabilities:
[Appium]   browserName: iPhone
[Appium]   platform: MAC
[Appium]   platformName: ios
[Appium]   unexpectedAlertBehaviour: true
[Appium]   unhandledPromptBehavior: true
[Appium]   version: 
[Appium]   autoAcceptAlerts: true
[Appium]   automationName: XCUITest
[Appium]   bundleId: XXX.XXX.XXX.XXXX
[Appium]   deviceName: iPhone 5s
[Appium]   newCommandTimeout: 2500
[Appium]   noReset: true
[Appium]   platformVersion: 11.2.6
[Appium]   udid: ebf79af8d3777b13fdfd9fc190424fdbfa869af9
[debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"browserNam... and MJSONWP desired capabilities {"noReset":true,"bundleId":... were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"browserNam...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: unhandledPromptBehavior, platform, unexpectedAlertBehaviour, version.
[XCUITest] Error: 'browserName' cannot be set together with 'bundleId' capability
[XCUITest]     at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[XCUITest]     at XCUITestDriver.validateDesiredCaps (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:947:13)
[XCUITest]     at XCUITestDriver.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/session.js:45:8)
[XCUITest]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest]     at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[XCUITest]     at new Promise (<anonymous>)
[XCUITest]     at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[XCUITest]     at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[XCUITest]     at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[XCUITest]     at XCUITestDriver.callee$0$0 [as createSession] (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/build/lib/basedriver/commands/session.js:35:30)
[XCUITest]     at XCUITestDriver.createSession$ (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:111:21)
[XCUITest]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest]     at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[XCUITest]     at new Promise (<anonymous>)
[XCUITest]     at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[XCUITest]     at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[XCUITest]     at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[XCUITest]     at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/build/lib/driver.js:247:34)
[XCUITest]     at AppiumDriver.callee$2$0$ (/usr/local/lib/node_modules/appium/lib/appium.js:291:43)
[XCUITest]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest]     at <anonymous>
[XCUITest]     at process._tickCallback (internal/process/next_tick.js:188:7)
[XCUITest] Error: 'browserName' cannot be set together with 'bundleId' capability
[XCUITest]     at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[XCUITest]     at XCUITestDriver.validateDesiredCaps (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:947:13)
[XCUITest]     at XCUITestDriver.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/session.js:45:8)
[XCUITest]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest]     at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[XCUITest]     at new Promise (<anonymous>)
[XCUITest]     at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[XCUITest]     at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[XCUITest]     at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[XCUITest]     at XCUITestDriver.callee$0$0 [as createSession] (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/build/lib/basedriver/commands/session.js:35:30)
[XCUITest]     at XCUITestDriver.createSession$ (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:111:21)
[XCUITest]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest]     at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[XCUITest]     at new Promise (<anonymous>)
[XCUITest]     at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[XCUITest]     at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[XCUITest]     at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[XCUITest]     at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/build/lib/driver.js:247:34)
[XCUITest]     at AppiumDriver.callee$2$0$ (/usr/local/lib/node_modules/appium/lib/appium.js:291:43)
[XCUITest]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest]     at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest]     at <anonymous>
[XCUITest]     at process._tickCallback (internal/process/next_tick.js:188:7)
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1539752480946 (10:31:20 GMT+0530 (IST))
[debug] [W3C] Encountered internal error running command: Error: 'browserName' cannot be set together with 'bundleId' capability
[debug] [W3C]     at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
[debug] [W3C]     at XCUITestDriver.validateDesiredCaps (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:947:13)
[debug] [W3C]     at XCUITestDriver.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/session.js:45:8)
[debug] [W3C]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[debug] [W3C]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C]     at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [W3C]     at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[debug] [W3C]     at new Promise (<anonymous>)
[debug] [W3C]     at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[debug] [W3C]     at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[debug] [W3C]     at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C]     at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[debug] [W3C]     at XCUITestDriver.callee$0$0 [as createSession] (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/build/lib/basedriver/commands/session.js:35:30)
[debug] [W3C]     at XCUITestDriver.createSession$ (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:111:21)
[debug] [W3C]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[debug] [W3C]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C]     at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [W3C]     at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
[debug] [W3C]     at new Promise (<anonymous>)
[debug] [W3C]     at new F (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.export.js:30:36)
[debug] [W3C]     at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
[debug] [W3C]     at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C]     at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
[debug] [W3C]     at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/build/lib/driver.js:247:34)
[debug] [W3C]     at AppiumDriver.callee$2$0$ (/usr/local/lib/node_modules/appium/lib/appium.js:291:43)
[debug] [W3C]     at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[debug] [W3C]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[debug] [W3C]     at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [W3C]     at <anonymous>
[debug] [W3C]     at process._tickCallback (internal/process/next_tick.js:188:7)
[HTTP] <-- POST /wd/hub/session 500 27 ms - 1277
[HTTP]

共有1个答案

程墨竹
2023-03-14

添加browserName功能的罪魁祸首是这一行,

caps = DesiredCapabilities.iphone();

相反,使用空的DesiredCapabilities初始化,如,

DesiredCapabilities caps = new DesiredCapabilities ();

当我们自动化Web应用程序时,我们需要指定BrowserName,否则只能指定bundleId,而不是两者兼而有之。

 类似资料:
  • 问题内容: 我将扮演一个恶魔的拥护者片刻。我一直想知道为什么将浏览器检测(而不是功能检测)视为一种不好的做法。如果我测试某个浏览器的某个版本并确认该功能以某种可预测的方式运行,则可以决定对其进行特殊处理。这样做的理由是将来会万无一失,因为此部分浏览器版本不会更改。另一方面,如果我检测到DOM元素具有函数X,则不一定表示: 此功能在所有浏览器中的工作方式相同,并且 更重要的是,即使在所有未来的浏览器

  • 我已经为我的web服务器(Apache)和WebSocket服务器(PHPWS)安装了let's Encypt(https://letsencrypt.org/)证书。问题是SSL WebSocket在Firefox上运行良好,但在Chrome、Chromium和Opera上却无法运行。我以前尝试过自签名证书和安全WebSocket在Chrome和Chromium中工作。 我的网页位于https:

  • 本文向大家介绍在Nginx浏览器中打开目录浏览功能,包括了在Nginx浏览器中打开目录浏览功能的使用技巧和注意事项,需要的朋友参考一下 在nginx中不像apache默认是打开目录浏览功能的,在nignx中目录浏览功能默认是关闭了,下面我来介绍在nginx中实现目录浏览功能的配置方法。 打开nginx.conf文件,在location server 或 http段中加入 另外两个参数最好也加上去:

  • 刚刚领导让我查一查浏览器屏幕共享的功能,有没有写过的或者遇见过的大哥能不能给个链接看一下

  • 因此,我试图为在android Emulator(avd)中运行的android应用程序编写一个自动化测试脚本,但我在Appium日志中发现以下错误: 我的设置是: Android Studio 162(w/sdk,注意这个最新版本不再包含'android'命令,android虚拟设备的创建是通过Tools完成的 在cmd中运行“adb devices”命令 所需功能设置为 运行测试时的IDE错误