java-client icon indicating copy to clipboard operation
java-client copied to clipboard

Appium 1.7.0 crashes Java client 5.0.3 when testing iOS

Open welnanick opened this issue 9 years ago • 26 comments

Description

When attempting to use java-client 5.0.3 to test an iOS device with Appium 1.7.0, the java-client crashes with java.lang.NullPointerException: null value in entry: browserName=null

Environment

  • java client build version or git revision if you use some shapshot: 5.0.3
  • Appium server version or git revision if you use some shapshot: 1.7.0
  • Desktop OS/version used to run Appium if necessary: macOS Sierra 10.12.6
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: Node.js v8.5.0, Appium 1.7.0
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: Real Device

Details

Using the same Appium Server, I can use appium-desktop using the custom server option to connect to the iOS device just fine. Android is unaffected. I believe this chunk of the logs are could relevant:

2017-09-19 22:43:55:863 - info: [HTTP] <-- POST /wd/hub/session 200 23221 ms - 589 
2017-09-19 22:43:55:908 - info: [HTTP] --> GET /wd/hub/session/c4c0364a-9a80-442e-b328-3dbb5d77418b {}
2017-09-19 22:43:55:909 - info: [debug] [MJSONWP] Calling AppiumDriver.getSession() with args: ["c4c0364a-9a80-442e-b328-3dbb5d77418b"]
2017-09-19 22:43:55:909 - info: [debug] [XCUITest] Executing command 'getSession'
2017-09-19 22:43:55:924 - info: [debug] [JSONWP Proxy] Proxying [GET /] to [GET http://localhost:8100/session/25E38EC3-E56F-44E4-806E-9B404F0A9D80] with no body
2017-09-19 22:43:56:103 - info: [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"sessionId\" : \"25E38EC3-E56F-44E4-806E-9B404F0A9D80\",\n    \"capabilities\" : {\n      \"device\" : \"iphone\",\n      \"browserName\" : null,\n      \"sdkVersion\" : \"10.3.2\",\n      \"CFBundleIdentifier\" : \"local.pid.53\"\n    }\n  },\n  \"sessionId\" : \"25E38EC3-E56F-44E4-806E-9B404F0A9D80\",\n  \"status\" : 0\n}"
2017-09-19 22:43:56:103 - info: [XCUITest] Merging WDA caps over Appium caps for session detail response
2017-09-19 22:43:56:104 - info: [debug] [MJSONWP] Responding to client with driver.getSession() result: {"udid":"67e44e99a952683ca27e8beccc50687bf4a71490","app":"/Users/nwelna/Documents/app-automation/appFiles/ios/app.ipa","xcodeOrgId":"UTURYJS693","automationName":"XCUITest","browserName":null,"platformName":"iOS","deviceName":"Test Device","xcodeSigningId":"iPhone Developer","usePrebuiltWDA":true,"device":"iphone","sdkVersion":"10.3.2","CFBundleIdentifier":"local.pid.53"}
2017-09-19 22:43:56:105 - info: [HTTP] <-- GET /wd/hub/session/c4c0364a-9a80-442e-b328-3dbb5d77418b 200 196 ms - 486 
2017-09-19 22:43:56:196 - info: [Appium] Received SIGTERM - shutting down

Code To Reproduce Issue [ Good To Have ]

Just attempt to connect to a real iOS device

Ecxeption stacktraces

gist

welnanick avatar Sep 19 '17 22:09 welnanick

Hello, Have same issue. Here is some details:

Versions: Appium v1.7.1 io.appium:java-client:5.0.3 node: v7.3.0 MacOs: 10.13.3 iOS Simulator.

Capabilities: 2018-04-20 11:09:11:555 - [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"CapabilityName":"com.techery.dtat.driver.capabilities.IPhoneCapabilities","app":"/Users/administrator/jenkins/workspace/UITests/AT.DreamTrips.iOS.BuildApp-Tests/../../apps/DreamTrip.app","autoAcceptAlerts":true,"automationName":"XCUITest","defaultCapability":false,"deviceName":"iPhone 7","fullReset":false,"newCommandTimeout":0,"noReset":false,"orientation":"PORTRAIT","platformName":"iOS","platformVersion":"10.3.1","showXcodeLog":true,"udid":"5B439EB7-CEFB-4D1B-A31B-190CD30F8D97","waitForAppScript":"true"},"capabilities":{"desiredCapabilities":{"CapabilityName":"com.techery.dtat.driver.capabilities.IPhoneCapabilities","app":"/Users/administrator/jenkins/workspace/UITests/AT.DreamTrips.iOS.BuildApp-Tests/../../apps/DreamTrip.app","autoAcceptAlerts":true,"automationName":"XCUITest","defaultCapability":false,"deviceName":"iPhone 7","fullReset":false,"newCommandTimeout":0,"noReset":false,"orientation":"PORTRAIT","platformName":"iOS","platformVersion":"10.3.1","showX 2018-04-20 11:09:11:556 - [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"CapabilityName":"com.techery.dtat.driver.capabilities.IPhoneCapabilities","app":"/Users/administrator/jenkins/workspace/UITests/AT.DreamTrips.iOS.BuildApp-Tests/../../apps/DreamTrip.app","autoAcceptAlerts":true,"automationName":"XCUITest","defaultCapability":false,"deviceName":"iPhone 7","fullReset":false,"newCommandTimeout":0,"noReset":false,"orientation":"PORTRAIT","platformName":"iOS","platformVersion":"10.3.1","showXcodeLog":true,"udid":"5B439EB7-CEFB-4D1B-A31B-190CD30F8D97","waitForAppScript":"true"},null,{"desiredCapabilities":{"CapabilityName":"com.techery.dtat.driver.capabilities.IPhoneCapabilities","app":"/Users/administrator/jenkins/workspace/UITests/AT.DreamTrips.iOS.BuildApp-Tests/../../apps/DreamTrip.app","autoAcceptAlerts":true,"automationName":"XCUITest","defaultCapability":false,"deviceName":"iPhone 7","fullReset":false,"newCommandTimeout":0,"noReset":false,"orientation":"PORTRAIT","platformName":"iOS","platformVersion":"10.3.1","showXcodeLog":true,"udid":"5B439EB7-CEFB-4D1B-A31B-190CD30...

Log: Gradle Test Executor 1 STANDARD_ERROR java.lang.NullPointerException: null value in entry: browserName=null at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:34) at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:175) at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:260) at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:275) at com.google.common.collect.ImmutableMap$Builder.putAll(ImmutableMap.java:303) at com.google.common.collect.ImmutableMap$Builder.putAll(ImmutableMap.java:286) at io.appium.java_client.HasSessionDetails.getSessionDetails(HasSessionDetails.java:38) at io.appium.java_client.HasSessionDetails.getSessionDetail(HasSessionDetails.java:42) at io.appium.java_client.HasSessionDetails.getPlatformName(HasSessionDetails.java:46) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:99) at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:122) at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:102)

Appium log:

2018-04-20 11:10:26:118 - [debug] [MJSONWP] Responding to client with driver.getSession() result: {"udid":"5B439EB7-CEFB-4D1B-A31B-190CD30F8D97","CapabilityName":"com.techery.dtat.driver.capabilities.IPhoneCapabilities","app":"/Users/administrator/jenkins/workspace/UITests/AT.DreamTrips.iOS.BuildApp-Tests/../../apps/DreamTrip.app","autoAcceptAlerts":true,"automationName":"XCUITest","defaultCapability":false,"deviceName":"iPhone 7","fullReset":false,"newCommandTimeout":0,"noReset":false,"orientation":"PORTRAIT","platformName":"iOS","platformVersion":"10.3.1","showXcodeLog":true,"waitForAppScript":"true","device":"iphone","browserName":null,"sdkVersion":"10.3.1","CFBundleIdentifier":"local.pid.45641"} 2018-04-20 11:10:26:119 - [HTTP] <-- GET /wd/hub/session/b16c36ba-8e07-4a45-bd9f-818dc52a79aa 200 135 ms - 682 11:10:26.121 [Test worker] ERROR (BaseWait.java:232): Caught an exception not listed in ignored exceptions classes: [class java.lang.NullPointerException]

victor-kalmus-techery avatar Apr 20 '18 09:04 victor-kalmus-techery

@victor-kalmus-techery Try to upgrade your client to the recent beta version

mykola-mokhnach avatar Apr 20 '18 09:04 mykola-mokhnach

Hi, I haven a problem I think is related to the fix for this issue. Ever since java-client:5.0.4 and upwards getSession() is called between each command to merge in my Desired Capabilities, severely increasing the test time. I have isolated the problem to a change between java-client version 5.0.3 and 5.0.4 and it still persists in the latest BETA version of java-client. It only occurs on iOS devices and only starts occurring when the java-client version is upped (nothing else changed). Is there some way to avoid this behavior?

  • Xcode version 9.2
  • iOS 11.2.5
  • selenium-java 3.11.0
  • io.appium java-client 6.0.0-BETA5
  • Appium server 1.7.2

Appium log snippet: gist

@mykola-mokhnach I am also facing extreme slowness issue with iOS native apps with the below configuration. Can you please give us some solution for the sudden slowness. -Xvode version 9.2 -iOS 11.2.5 -Selenium Server Standalone 3.12 -io.appium javaclient 6.0.0 -Appium Server 1.7.2

Please do the needful.

githubdilip avatar Jun 07 '18 13:06 githubdilip

@githubdilip https://github.com/appium/java-client/issues/930#issuecomment-395346358

mykola-mokhnach avatar Jun 07 '18 13:06 mykola-mokhnach

@mykola-mokhnach Thanks a lot.. It worked...

githubdilip avatar Jun 07 '18 14:06 githubdilip