无法使用浏览器堆栈单击 iPhone 上 Appium 上的按钮

问题描述 投票:0回答:0

我正在尝试编写代码,它需要在 Android 和 iOS 上运行。流程是点击一个按钮关闭屏幕。我的代码在 Android 上运行良好,但在 iOS 上却失败了。我没有 Mac 设置,所以我使用浏览器堆栈在 iOS 上运行我的测试。我的代码在下面。

 //The android element is the parent element
    @AndroidFindBy(id = "com.tractive.android.gps.staging:id/tb_tractivetoolbar")
    private MobileElement parent;
    @iOSXCUITFindBy(id ="Done")
    private MobileElement done;


public  void clickCloseButton(String platformName, boolean cloud) {
    if (platformName.equals(LocalConfig.ANDROID_PLATFORM_NAME))
    {
        parent.findElement(MobileBy.className("android.widget.ImageButton")).click();
    }
    else if (platformName.equals(LocalConfig.IOS_PLATFORM_NAME)){
        done.click();
    }
}

iOS 失败并给出以下异常,

org.openqa.selenium.UnsupportedCommandException: Unhandled endpoint: /session/D68E99D5-A49E-4B81-81C0-0D0E097DEB81/click -- http://127.0.0.1:8403/ with parameters {
    wildcards =     (
        "session/D68E99D5-A49E-4B81-81C0-0D0E097DEB81/click"
    );
} (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-SM73JSJ', ip: '10.10.3.251', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.14.1'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {64bit: false, acceptSslCert: false, acceptSslCerts: false, automationName: XCUITest, bootstrapPath: /usr/local/.browserstack/co..., browserName: , browserstack.appium_version: 1.21.0, browserstack.isTargetBased: false, browserstack.is_hub_canary: false, browserstack.minOSVersion: 13.4, buildName: GHH iOS Specific Local Test..., bundleID: com.tractive.ios.staging.gps, bundleId: com.tractive.ios.staging.gps, capabilities: {64bit: false, acceptSslCert: false, acceptSslCerts: false, automationName: XCUITest, bootstrapPath: /usr/local/.browserstack/co..., browserName: , browserstack.appium_version: 1.21.0, browserstack.isTargetBased: false, browserstack.is_hub_canary: false, browserstack.minOSVersion: 13.4, buildName: GHH iOS Specific Local Test..., bundleID: com.tractive.ios.staging.gps, bundleId: com.tractive.ios.staging.gps, custom_replay_kit_params: {"rotation":"false","captur..., databaseEnabled: false, detected_language: selenium/3.141.59 (java win..., device: iphone, deviceName: iPhone 11, deviceOrientation: PORTRAIT, javascriptEnabled: true, locationContextEnabled: false, mobile: {browser: mobile, version: iPhone 11-15.4}, networkConnectionEnabled: false, newCommandTimeout: 0, new_bucketing: true, noReset: true, orientation: PORTRAIT, orig_os: ios, osVersion: 15, os_version: 15.0, platform: MAC, platformName: iOS, processArguments: {args: [--scope-ui-test]}, projectName: iOS Staging, realMobile: true, safariIgnoreFraudWarning: true, safariInitialUrl: http://mobile-internet-chec..., sessionId: d1d084956c28d721471bf3f6b94..., sessionName: publicLocationShareTest on ..., takesScreenshot: true, udid: 00008030-001245480C28802E, uiautomator2ServerLaunchTimeout: 60000, useXctestrunFile: true, version: , waitForQuiescence: false, wdaStartupRetries: 3, wda_port: 8403, webStorageEnabled: false, webkitResponseTimeout: 20000}, custom_replay_kit_params: {"rotation":"false","captur..., databaseEnabled: false, detected_language: selenium/3.141.59 (java win..., device: iphone, deviceName: iPhone 11, deviceOrientation: PORTRAIT, javascriptEnabled: true, locationContextEnabled: false, mobile: {browser: mobile, version: iPhone 11-15.4}, networkConnectionEnabled: false, newCommandTimeout: 0, new_bucketing: true, noReset: true, orientation: PORTRAIT, orig_os: ios, osVersion: 15, os_version: 15.0, platform: MAC, platformName: iOS, processArguments: {args: [--scope-ui-test]}, projectName: iOS Staging, realMobile: true, safariIgnoreFraudWarning: true, safariInitialUrl: http://mobile-internet-chec..., sessionId: d1d084956c28d721471bf3f6b94..., sessionName: publicLocationShareTest on ..., takesScreenshot: true, udid: 00008030-001245480C28802E, uiautomator2ServerLaunchTimeout: 60000, useXctestrunFile: true, version: , waitForQuiescence: false, wdaStartupRetries: 3, wda_port: 8403, webStorageEnabled: false, webkitResponseTimeout: 20000}
Session ID: d1d084956c28d721471bf3f6b942b93e510d2dc7

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
    at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:35)
    at org.openqa.selenium.remote.RemoteMouse.click(RemoteMouse.java:59)
    at org.openqa.selenium.interactions.ClickAction.perform(ClickAction.java:39)
    at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:34)
    at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:642)
    at org.openqa.selenium.interactions.Actions.perform(Actions.java:595)
    at page.BaseScreen.iOSClick(BaseScreen.java:79)
    at page.main.map.ShareTrackingLinkScreen.clickCloseButton(ShareTrackingLinkScreen.java:46)
    at scenario.TrackerFeatures.publicLocationShareTest(TrackerFeatures.java:168)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

Tearing down publicLocationShareTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Cleaning up BrowserStack duplicate (repeated) builds
appium appium-android appium-ios appium-java
© www.soinside.com 2019 - 2024. All rights reserved.