问:
org.openqa.selenium.WebDriverException:java.io.IOException
Test fails on AWS device farm (running for iOS) after running few scripts with

org.openqa.selenium.WebDriverException:java.io.IOException: unexpected
end of stream on Connection{127.0.0.1:4723, proxy=DIRECT
hostAddress=/127.0.0.1:4723 cipherSuite=none protocol=http/1.1}

Selenium-java version is 3.141.59.

When I run my script on local with platform version 12.1 and device Name is iPhone 6 plus, it runs smoothly. But fails on device farm with any device and version(I have checked on few, iPhone 7, version 11.0 is one of those).

I have tried running on many other compatible different iOS version, still face the same issue. I have tried on both 127.0.0.1:4723 and 0.0.0.0:4723.

-[TestNG] org.openqa.selenium.WebDriverException: java.io.IOException: unexpected end of stream on Connection{127.0.0.1:4723, proxy=DIRECT
hostAddress=/127.0.0.1:4723 cipherSuite=none protocol=http/1.1}

-Caused by: java.io.EOFException: \n not found: limit=0 content=…

```2019-05-24 13:48:23:165 - [Appium] Welcome to Appium v1.9.1
2019-05-24 13:48:23:167 - [Appium] Non-default server args:
2019-05-24 13:48:23:170 - [Appium]   logTimestamp: true
2019-05-24 13:48:23:170 - [Appium]   defaultCapabilities: {
2019-05-24 13:48:23:170 - [Appium]     usePrebuiltWDA: true
2019-05-24 13:48:23:171 - [Appium]     derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:23:171 - [Appium]     platformName: iOS
2019-05-24 13:48:23:171 - [Appium]     automationName: XCUITest
2019-05-24 13:48:23:171 - [Appium]     deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:172 - [Appium]     app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:23:172 - [Appium]     udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:173 - [Appium]   }
2019-05-24 13:48:23:173 - [Appium]   platformName: iOS
2019-05-24 13:48:23:173 - [Appium]   automationName: XCUITest
2019-05-24 13:48:23:173 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:173 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:23:174 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:228 - [Appium] Deprecated server args:
2019-05-24 13:48:23:229 - [Appium]   --platform-name => --default-capabilities '{"platformName":"iOS"}'
2019-05-24 13:48:23:230 - [Appium]   --automation-name => --default-capabilities '{"automationName":"XCUITest"}'
2019-05-24 13:48:23:230 - [Appium]   --device-name => --default-capabilities '{"deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0"}'
2019-05-24 13:48:23:230 - [Appium]   --app => --default-capabilities '{"app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa"}'
2019-05-24 13:48:23:231 - [Appium]   -U,--udid => --default-capabilities '{"udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0"}'
2019-05-24 13:48:23:231 - [Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
2019-05-24 13:48:23:231 - [Appium]   usePrebuiltWDA: true
2019-05-24 13:48:23:231 - [Appium]   derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:23:231 - [Appium]   platformName: iOS
2019-05-24 13:48:23:232 - [Appium]   automationName: XCUITest
2019-05-24 13:48:23:232 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:232 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:23:232 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:429 - [Appium] Appium REST http interface listener started on 0.0.0.0:4723
2019-05-24 13:48:29:584 - [HTTP] --> POST /wd/hub/session
2019-05-24 13:48:29:584 - [HTTP] {"desiredCapabilities":{"bundleId":"some_bundle_id","platformName":"iOS"},"capabilities":{"desiredCapabilities":{"bundleId":"some_bundle_id","platformName":"iOS"},"firstMatch":[{"appium:bundleId":"some_bundle_id","platformName":"ios"}]}}
2019-05-24 13:48:29:587 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"bundleId":"some_bundle_id","platformName":"iOS"},null,{"desiredCapabilities":{"bundleId":"some_bundle_id","platformName":"iOS"},"firstMatch":[{"appium:bundleId":"some_bundle_id","platformName":"ios"}]}]
2019-05-24 13:48:29:588 - [debug] [BaseDriver] Event 'newSessionRequested' logged at 1558705709588 (06:48:29 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:29:592 - [BaseDriver] The capabilities ["usePrebuiltWDA","derivedDataPath","automationName","deviceName","app","udid"] are not standard capabilities and should have an extension prefix
2019-05-24 13:48:29:597 - [Appium] Creating new XCUITestDriver (v2.94.2) session
2019-05-24 13:48:29:597 - [Appium] Capabilities:
2019-05-24 13:48:29:597 - [Appium]   platformName: ios
2019-05-24 13:48:29:597 - [Appium]   usePrebuiltWDA: true
2019-05-24 13:48:29:597 - [Appium]   derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:29:598 - [Appium]   automationName: XCUITest
2019-05-24 13:48:29:598 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:29:598 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   bundleId: some_bundle_id
2019-05-24 13:48:29:602 - [debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"usePrebuiltWDA":true,"der... were provided
2019-05-24 13:48:29:602 - [debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
2019-05-24 13:48:29:612 - [BaseDriver] Session created with session id: 2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
(node:464) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
2019-05-24 13:48:29:869 - [debug] [XCUITest] Current user: 'device-farm'
2019-05-24 13:48:30:348 - [debug] [XCUITest] Xcode version set to '10.1' (tools v9.4.0.0.1.1526532315)
2019-05-24 13:48:42:741 - [debug] [XCUITest] iOS SDK Version set to '12.1'
2019-05-24 13:48:42:741 - [debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1558705722741 (06:48:42 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:56:256 - [debug] [XCUITest] Available devices: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:56:257 - [debug] [XCUITest] Creating iDevice object with udid '4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0'
2019-05-24 13:48:56:260 - [XCUITest] Determining device to run tests on: udid: '4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0', real device: true
2019-05-24 13:48:56:262 - [BaseDriver] Using local app '/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa'
2019-05-24 13:48:56:262 - [debug] [BaseDriver] Copying local zip to tmp dir
2019-05-24 13:48:56:286 - [BaseDriver] Unzipping local app '/tmp/2019424-464-d635jg.9mcjv/appium-app.zip'...
2019-05-24 13:48:56:316 - [debug] [BaseDriver] Unzipping /tmp/2019424-464-d635jg.9mcjv/appium-app.zip
2019-05-24 13:48:56:316 - [debug] [BaseDriver] Testing zip archive: /tmp/2019424-464-d635jg.9mcjv/appium-app.zip
2019-05-24 13:48:57:794 - [BaseDriver] Unzipped local app to '/tmp/2019424-464-d635jg.9mcjv/Payload/testProject.app'
2019-05-24 13:48:57:795 - [debug] [BaseDriver] Event 'appConfigured' logged at 1558705737795 (06:48:57 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:57:795 - [debug] [XCUITest] Checking whether app '/tmp/2019424-464-d635jg.9mcjv/Payload/SubmissionTracker.app' is actually present on file system
2019-05-24 13:48:57:796 - [debug] [XCUITest] App is present
2019-05-24 13:48:57:796 - [debug] [BaseDriver] Event 'resetStarted' logged at 1558705737796 (06:48:57 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:57:796 - [debug] [XCUITest] Reset: running ios real device reset flow
2019-05-24 13:48:57:797 - [debug] [BaseDriver] Event 'resetComplete' logged at 1558705737797 (06:48:57 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:57:799 - [debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
2019-05-24 13:48:57:800 - [debug] [iOSLog] Starting iOS device log capture with: 'idevicesyslog'
2019-05-24 13:48:58:584 - [debug] [XCUITest] Crash reports root '/Users/device-farm/Library/Logs/CrashReporter/MobileDevice/9902472561' does not exist. Got nothing to gather.
2019-05-24 13:48:58:584 - [debug] [BaseDriver] Event 'logCaptureStarted' logged at 1558705738584 (06:48:58 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:58:584 - [XCUITest] Setting up real device
2019-05-24 13:48:58:585 - [debug] [XCUITest] Verifying application platform
2019-05-24 13:48:58:596 - [debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneOS"]
2019-05-24 13:49:01:091 - [debug] [XCUITest] Reset requested. Removing app with id 'some_bundle_id' from the device
2019-05-24 13:49:03:324 - [debug] [XCUITest] Installing '/tmp/2019424-464-d635jg.9mcjv/Payload/testProject.app' on device with UUID '4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0'...
2019-05-24 13:49:10:747 - [debug] [XCUITest] The app has been installed successfully.
2019-05-24 13:49:10:748 - [debug] [BaseDriver] Event 'appInstalled' logged at 1558705750748 (06:49:10 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:49:10:750 - [XCUITest] Using WDA path: '/usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
2019-05-24 13:49:10:752 - [XCUITest] Using WDA agent: '/usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
2019-05-24 13:49:10:815 - [debug] [XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
2019-05-24 13:49:10:820 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:49:10:821 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:49:10:836 - [debug] [XCUITest] WDA is not listening at 'http://localhost:8100/'
2019-05-24 13:49:10:837 - [debug] [XCUITest] WDA is currently not running. There is nothing to cache
2019-05-24 13:49:10:837 - [debug] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
2019-05-24 13:49:10:838 - [debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1558705750838 (06:49:10 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:49:10:839 - [XCUITest] Launching WebDriverAgent on the device
2019-05-24 13:49:10:955 - [debug] [XCUITest] Carthage found: '/usr/local/bin/carthage'
2019-05-24 13:49:10:955 - [debug] [XCUITest] Running WebDriverAgent bootstrap script to install dependencies
2019-05-24 13:49:39:997 - [debug] [XCUITest] Creating WebDriverAgent resources directory
2019-05-24 13:49:39:998 - [debug] [XCUITest] Creating WebDriverAgent resource bundle directory
2019-05-24 13:49:39:999 - [debug] [XCUITest] Cleaning the project scheme 'WebDriverAgentLib' to make sure there are no leftovers from previous installs
2019-05-24 13:49:52:882 - [debug] [XCUITest] Cleaning the project scheme 'WebDriverAgentRunner' to make sure there are no leftovers from previous installs
2019-05-24 13:50:01:514 - [debug] [XCUITest] Killing running processes 'xcodebuild.*4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0, iproxy 8100' for the device 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0...
2019-05-24 13:50:01:602 - [debug] [XCUITest] 'pgrep -nif xcodebuild.*4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0' didn't detect any matching processes. Return code: 1
2019-05-24 13:50:01:655 - [debug] [XCUITest] 'pgrep -nif iproxy 8100' didn't detect any matching processes. Return code: 1
2019-05-24 13:50:01:655 - [debug] [XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB for the device 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:50:06:818 - [XCUITest] Cannot parse major and minor version numbers from platformVersion "null". Will build for the default platform instead
2019-05-24 13:50:06:819 - [debug] [XCUITest] Beginning test with command 'xcodebuild test-without-building -project /usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /tmp/scratchmfswDs.scratch/DerivedData1JgqWF -destination id=4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0' in directory '/usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
2019-05-24 13:50:06:820 - [debug] [XCUITest] Output from xcodebuild will not be logged. To change this, use 'showXcodeLog' desired capability
2019-05-24 13:50:10:188 - [debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
2019-05-24 13:50:10:188 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:10:189 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:11:340 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:11:340 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:12:380 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:12:380 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:13:433 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:13:433 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:14:477 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:14:478 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:15:508 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:15:509 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:15:750 - [debug] [XCUITest] Log file for xcodebuild test: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF/Logs/Test/Test-WebDriverAgentRunner-2019.05.24_06-50-15--0700.xcresult/1_Test/Diagnostics/WebDriverAgentRunner-617486B3-34EB-4195-A160-0EF9A788792C/WebDriverAgentRunner-1E30900B-8D08-41D1-8C4E-7D02A3E9CDB5/Session-WebDriverAgentRunner-2019-05-24_065015-ghzVbu.log
2019-05-24 13:50:16:571 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'

2019-05-24 13:50:34:240 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:35:284 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:35:285 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:35:361 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"state\" : \"success\",\n    \"os\" : {\n      \"name\" : \"iOS\",\n      \"version\" : \"12.0\",\n      \"sdkVersion\" : \"12.0\"\n    },\n    \"ios\" : {\n      \"simulatorVersion\" : \"12.0\",\n      \"ip\" : \"192.168.1.10\"\n    },\n    \"build\" : {\n      \"upgradedAt\" : \"1558705779000\",\n      \"time\" : \"Nov 29 2018 13:42:57\",\n      \"productBundleIdentifier\" : \"com.facebook.WebDriverAgentRunner\"\n    }\n  },\n  \"sessionId\" : \"2C9B264F-15B5-4C9B-84AE-A19F79EE11B1\",\n  \"status\" : 0\n}"
2019-05-24 13:50:35:363 - [debug] [XCUITest] WebDriverAgent information:
2019-05-24 13:50:35:364 - [debug] [XCUITest] {
2019-05-24 13:50:35:364 - [debug] [XCUITest]   "state": "success",
2019-05-24 13:50:35:364 - [debug] [XCUITest]   "os": {
2019-05-24 13:50:35:364 - [debug] [XCUITest]     "name": "iOS",
2019-05-24 13:50:35:364 - [debug] [XCUITest]     "version": "12.0",
2019-05-24 13:50:35:364 - [debug] [XCUITest]     "sdkVersion": "12.0"
2019-05-24 13:50:35:364 - [debug] [XCUITest]   },
2019-05-24 13:50:35:365 - [debug] [XCUITest]   "ios": {
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "simulatorVersion": "12.0",
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "ip": "192.168.1.10"
2019-05-24 13:50:35:365 - [debug] [XCUITest]   },
2019-05-24 13:50:35:365 - [debug] [XCUITest]   "build": {
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "upgradedAt": "1558705779000",
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "time": "Nov 29 2018 13:42:57",
2019-05-24 13:50:35:366 - [debug] [XCUITest]     "productBundleIdentifier": "com.facebook.WebDriverAgentRunner"
2019-05-24 13:50:35:366 - [debug] [XCUITest]   }
2019-05-24 13:50:35:366 - [debug] [XCUITest] }
2019-05-24 13:50:35:366 - [debug] [XCUITest] WebDriverAgent successfully started after 28545ms
2019-05-24 13:50:35:367 - [debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1558705835367 (06:50:35 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:35:368 - [debug] [XCUITest] Sending createSession command to WDA
2019-05-24 13:50:35:369 - [debug] [JSONWP Proxy] Matched '/session' to command name 'createSession'
2019-05-24 13:50:35:370 - [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"some_bundle_id","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
2019-05-24 13:50:37:324 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","capabilities":{"device":"iphone","browserName":"My Test Project","sdkVersion":"12.0","CFBundleIdentifier":"some_bundle_id"}},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":0}
2019-05-24 13:50:37:324 - [debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1558705837324 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:324 - [debug] [BaseDriver] Event 'wdaStarted' logged at 1558705837324 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:325 - [XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
2019-05-24 13:50:37:325 - [debug] [BaseDriver] Event 'orientationSet' logged at 1558705837325 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:326 - [Appium] New XCUITestDriver session created successfully, session 2b0a8f8e-26bc-4c58-9629-66f9f7fa338d added to master session list
2019-05-24 13:50:37:327 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1558705837327 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:328 - [debug] [W3C] Cached the protocol value 'W3C' for the new session 2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
2019-05-24 13:50:37:328 - [debug] [W3C] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","usePrebuiltWDA":true,"derivedDataPath":"/tmp/scratchmfswDs.scratch/DerivedData1JgqWF","automationName":"XCUITest","deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa","udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","bundleId":"some_bundle_id"}}
2019-05-24 13:50:37:332 - [HTTP] <-- POST /wd/hub/session 200 127747 ms - 629
2019-05-24 13:50:37:332 - [HTTP]
2019-05-24 13:50:37:517 - [HTTP] --> GET /wd/hub/session/2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
2019-05-24 13:50:37:517 - [HTTP] {}
2019-05-24 13:50:37:518 - [debug] [W3C] Calling AppiumDriver.getSession() with args: ["2b0a8f8e-26bc-4c58-9629-66f9f7fa338d"]
2019-05-24 13:50:37:519 - [debug] [XCUITest] Executing command 'getSession'
2019-05-24 13:50:37:530 - [debug] [JSONWP Proxy] Matched '/' to command name 'getSession'
2019-05-24 13:50:37:530 - [debug] [JSONWP Proxy] Proxying [GET /] to [GET http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E] with no body
2019-05-24 13:50:37:615 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n    \"capabilities\" : {\n      \"device\" : \"iphone\",\n      \"browserName\" : \"My Test Project\",\n      \"sdkVersion\" : \"12.0\",\n      \"CFBundleIdentifier\" : \"some_bundle_id\"\n    }\n  },\n  \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n  \"status\" : 0\n}"
2019-05-24 13:50:37:635 - [debug] [JSONWP Proxy] Proxying [GET /wda/screen] to [GET http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/wda/screen] with no body
2019-05-24 13:50:37:869 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"statusBarSize\" : {\n      \"width\" : 375,\n      \"height\" : 20\n    },\n    \"scale\" : 2\n  },\n  \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n  \"status\" : 0\n}"
2019-05-24 13:50:37:872 - [debug] [JSONWP Proxy] Proxying [GET /window/size] to [GET http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/window/size] with no body
2019-05-24 13:50:38:006 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"width\" : 375,\n    \"height\" : 667\n  },\n  \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n  \"status\" : 0\n}"
2019-05-24 13:50:38:007 - [XCUITest] Merging WDA caps over Appium caps for session detail response
2019-05-24 13:50:38:009 - [debug] [W3C] Responding to client with driver.getSession() result: {"udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","platformName":"ios","usePrebuiltWDA":true,"derivedDataPath":"/tmp/scratchmfswDs.scratch/DerivedData1JgqWF","automationName":"XCUITest","deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa","bundleId":"some_bundle_id","device":"iphone","browserName":"My Test Project {","sdkVersion":"12.0","CFBundleIdentifier":"some_bundle_id","pixelRatio":2,"statBarHeight":20,"viewportRect":{"left":0,"top":40,"width":750,"height":1294}}
2019-05-24 13:50:38:044 - [HTTP] <-- GET /wd/hub/session/2b0a8f8e-26bc-4c58-9629-66f9f7fa338d 200 493 ms - 587
2019-05-24 13:50:38:044 - [HTTP]
2019-05-24 13:50:38:046 - [HTTP] --> GET /wd/hub/session/2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
2019-05-24 13:50:38:046 - [HTTP] {}
2019-05-24 13:50:38:047 - [debug] [W3C] Calling AppiumDriver.getSession() with args: ["2b0a8f8e-26bc-4c58-9629-66f9f7fa338d"]
2019-05-24 13:50:38:047 - [debug] [XCUITest] Executing command 'getSession'
2019-05-24 13:50:38:049 - [XCUITest] Merging WDA caps over Appium caps for session detail response
2019-05-24 13:50:38:050 - [debug] [W3C] Responding to client with driver.getSession() result: {"udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","platformName":"ios","usePrebuiltWDA":true,"derivedDataPath":"/tmp/scratchmfswDs.scratch/DerivedData1JgqWF","automationName":"XCUITest","deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa","bundleId":"some_bundle_id","device":"iphone","browserName":"My Test Project","sdkVersion":"12.0","CFBundleIdentifier":"some_bundle_id","pixelRatio":2,"statBarHeight":20,"viewportRect":{"left":0,"top":40,"width":750,"height":1294}}
2019-05-24 13:50:52:923 - [HTTP] {"using":"id","value":"testInput"}
2019-05-24 13:50:52:924 - [debug] [W3C] Calling AppiumDriver.findElement() with args: ["id","testInput","2b0a8f8e-26bc-4c58-9629-66f9f7fa338d"]
2019-05-24 13:50:52:924 - [debug] [XCUITest] Executing command 'findElement'
2019-05-24 13:50:52:925 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2019-05-24 13:50:52:925 - [debug] [BaseDriver] Waiting up to 6000000 ms for condition
2019-05-24 13:50:52:926 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:52:926 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:53:129 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:53:130 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:53:130 - [debug] [BaseDriver] Waited for 205 ms so far
2019-05-24 13:50:53:709 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:53:710 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:53:923 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:53:924 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:53:924 - [debug] [BaseDriver] Waited for 999 ms so far
2019-05-24 13:50:54:442 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:54:442 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:54:635 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:54:636 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:54:636 - [debug] [BaseDriver] Waited for 1711 ms so far
2019-05-24 13:50:55:277 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:55:277 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:55:491 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:55:491 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:55:491 - [debug] [BaseDriver] Waited for 2566 ms so far
2019-05-24 13:50:55:991 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:55:992 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:56:155 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:56:155 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:56:156 - [debug] [BaseDriver] Waited for 3231 ms so far
2019-05-24 13:50:56:701 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:56:702 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:56:913 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:56:913 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
```

答:
Thanks for posting those logs! It looks like the capabilities are valid(though the bundle id is obviously not valid). The bundleId will automatically be taken from the ipa file so it shouldn't be necessary to provide that if we also have the app capability.

http://appium.io/docs/en/writing-running-appium/caps/#ios-only

Bundle ID of the app under test. Useful for starting an app on a real device or for using other caps which require the bundle ID during test startup. To run a test on a real device using the bundle ID, you may omit the 'app' capability, but you must provide 'udid'.

The default capabilities required for the app to start should be already provided by the default appium server CLI command in the testspec.yml file.

appium --log-timestamp --device-name $DEVICEFARM_DEVICE_NAME --platform-name $DEVICEFARM_DEVICE_PLATFORM_NAME --app $DEVICEFARM_APP_PATH --udid $DEVICEFARM_DEVICE_UDID --automation-name XCUITest --default-capabilities "{\"usePrebuiltWDA\": true, \"derivedDataPath\":\"$DEVICEFARM_WDA_DERIVED_DATA_PATH_V1\"}" >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &

Capabilities

```<code>2019-05-24 13:48:29:597 - [Appium] Creating new XCUITestDriver (v2.94.2) session
2019-05-24 13:48:29:597 - [Appium] Capabilities:
2019-05-24 13:48:29:597 - [Appium]   platformName: ios
2019-05-24 13:48:29:597 - [Appium]   usePrebuiltWDA: true
2019-05-24 13:48:29:597 - [Appium]   derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:29:598 - [Appium]   automationName: XCUITest
2019-05-24 13:48:29:598 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:29:598 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   bundleId: some_bundle_id
</code>```

Since the error, in this case, is regarding how to find an element I would think the best thing to do for that is to print the page source and first confirm that the element is there. You can also do this using a capability which will print the page source when the script errors.

http://appium.io/docs/en/writing-running-appium/caps/#general-capabilities

printPageSourceOnFindFailure  When a find operation fails, print the current page source. Defaults to false.  e.g., true

Appium server log snippet

```<code>2019-05-24 13:50:56:701 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:56:702 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:56:913 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:56:913 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
</code>```

Can you print the page source and follow up with the result?

HTH

-James

Body:
Test fails on AWS device farm (running for iOS) after running few scripts with

org.openqa.selenium.WebDriverException:java.io.IOException: unexpected
end of stream on Connection{127.0.0.1:4723, proxy=DIRECT
hostAddress=/127.0.0.1:4723 cipherSuite=none protocol=http/1.1}

Selenium-java version is 3.141.59.

When I run my script on local with platform version 12.1 and device Name is iPhone 6 plus, it runs smoothly. But fails on device farm with any device and version(I have checked on few, iPhone 7, version 11.0 is one of those).

I have tried running on many other compatible different iOS version, still face the same issue. I have tried on both 127.0.0.1:4723 and 0.0.0.0:4723.

-[TestNG] org.openqa.selenium.WebDriverException: java.io.IOException: unexpected end of stream on Connection{127.0.0.1:4723, proxy=DIRECT
hostAddress=/127.0.0.1:4723 cipherSuite=none protocol=http/1.1}

-Caused by: java.io.EOFException: \n not found: limit=0 content=…

2019-05-24 13:48:23:165 - [Appium] Welcome to Appium v1.9.1
2019-05-24 13:48:23:167 - [Appium] Non-default server args:
2019-05-24 13:48:23:170 - [Appium]   logTimestamp: true
2019-05-24 13:48:23:170 - [Appium]   defaultCapabilities: {
2019-05-24 13:48:23:170 - [Appium]     usePrebuiltWDA: true
2019-05-24 13:48:23:171 - [Appium]     derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:23:171 - [Appium]     platformName: iOS
2019-05-24 13:48:23:171 - [Appium]     automationName: XCUITest
2019-05-24 13:48:23:171 - [Appium]     deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:172 - [Appium]     app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:23:172 - [Appium]     udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:173 - [Appium]   }
2019-05-24 13:48:23:173 - [Appium]   platformName: iOS
2019-05-24 13:48:23:173 - [Appium]   automationName: XCUITest
2019-05-24 13:48:23:173 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:173 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:23:174 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:228 - [Appium] Deprecated server args:
2019-05-24 13:48:23:229 - [Appium]   --platform-name => --default-capabilities '{"platformName":"iOS"}'
2019-05-24 13:48:23:230 - [Appium]   --automation-name => --default-capabilities '{"automationName":"XCUITest"}'
2019-05-24 13:48:23:230 - [Appium]   --device-name => --default-capabilities '{"deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0"}'
2019-05-24 13:48:23:230 - [Appium]   --app => --default-capabilities '{"app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa"}'
2019-05-24 13:48:23:231 - [Appium]   -U,--udid => --default-capabilities '{"udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0"}'
2019-05-24 13:48:23:231 - [Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
2019-05-24 13:48:23:231 - [Appium]   usePrebuiltWDA: true
2019-05-24 13:48:23:231 - [Appium]   derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:23:231 - [Appium]   platformName: iOS
2019-05-24 13:48:23:232 - [Appium]   automationName: XCUITest
2019-05-24 13:48:23:232 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:232 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:23:232 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:23:429 - [Appium] Appium REST http interface listener started on 0.0.0.0:4723
2019-05-24 13:48:29:584 - [HTTP] --> POST /wd/hub/session
2019-05-24 13:48:29:584 - [HTTP] {"desiredCapabilities":{"bundleId":"some_bundle_id","platformName":"iOS"},"capabilities":{"desiredCapabilities":{"bundleId":"some_bundle_id","platformName":"iOS"},"firstMatch":[{"appium:bundleId":"some_bundle_id","platformName":"ios"}]}}
2019-05-24 13:48:29:587 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"bundleId":"some_bundle_id","platformName":"iOS"},null,{"desiredCapabilities":{"bundleId":"some_bundle_id","platformName":"iOS"},"firstMatch":[{"appium:bundleId":"some_bundle_id","platformName":"ios"}]}]
2019-05-24 13:48:29:588 - [debug] [BaseDriver] Event 'newSessionRequested' logged at 1558705709588 (06:48:29 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:29:592 - [BaseDriver] The capabilities ["usePrebuiltWDA","derivedDataPath","automationName","deviceName","app","udid"] are not standard capabilities and should have an extension prefix
2019-05-24 13:48:29:597 - [Appium] Creating new XCUITestDriver (v2.94.2) session
2019-05-24 13:48:29:597 - [Appium] Capabilities:
2019-05-24 13:48:29:597 - [Appium]   platformName: ios
2019-05-24 13:48:29:597 - [Appium]   usePrebuiltWDA: true
2019-05-24 13:48:29:597 - [Appium]   derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:29:598 - [Appium]   automationName: XCUITest
2019-05-24 13:48:29:598 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:29:598 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   bundleId: some_bundle_id
2019-05-24 13:48:29:602 - [debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"usePrebuiltWDA":true,"der... were provided
2019-05-24 13:48:29:602 - [debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
2019-05-24 13:48:29:612 - [BaseDriver] Session created with session id: 2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
(node:464) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
2019-05-24 13:48:29:869 - [debug] [XCUITest] Current user: 'device-farm'
2019-05-24 13:48:30:348 - [debug] [XCUITest] Xcode version set to '10.1' (tools v9.4.0.0.1.1526532315)
2019-05-24 13:48:42:741 - [debug] [XCUITest] iOS SDK Version set to '12.1'
2019-05-24 13:48:42:741 - [debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1558705722741 (06:48:42 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:56:256 - [debug] [XCUITest] Available devices: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:56:257 - [debug] [XCUITest] Creating iDevice object with udid '4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0'
2019-05-24 13:48:56:260 - [XCUITest] Determining device to run tests on: udid: '4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0', real device: true
2019-05-24 13:48:56:262 - [BaseDriver] Using local app '/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa'
2019-05-24 13:48:56:262 - [debug] [BaseDriver] Copying local zip to tmp dir
2019-05-24 13:48:56:286 - [BaseDriver] Unzipping local app '/tmp/2019424-464-d635jg.9mcjv/appium-app.zip'...
2019-05-24 13:48:56:316 - [debug] [BaseDriver] Unzipping /tmp/2019424-464-d635jg.9mcjv/appium-app.zip
2019-05-24 13:48:56:316 - [debug] [BaseDriver] Testing zip archive: /tmp/2019424-464-d635jg.9mcjv/appium-app.zip
2019-05-24 13:48:57:794 - [BaseDriver] Unzipped local app to '/tmp/2019424-464-d635jg.9mcjv/Payload/testProject.app'
2019-05-24 13:48:57:795 - [debug] [BaseDriver] Event 'appConfigured' logged at 1558705737795 (06:48:57 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:57:795 - [debug] [XCUITest] Checking whether app '/tmp/2019424-464-d635jg.9mcjv/Payload/SubmissionTracker.app' is actually present on file system
2019-05-24 13:48:57:796 - [debug] [XCUITest] App is present
2019-05-24 13:48:57:796 - [debug] [BaseDriver] Event 'resetStarted' logged at 1558705737796 (06:48:57 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:57:796 - [debug] [XCUITest] Reset: running ios real device reset flow
2019-05-24 13:48:57:797 - [debug] [BaseDriver] Event 'resetComplete' logged at 1558705737797 (06:48:57 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:57:799 - [debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
2019-05-24 13:48:57:800 - [debug] [iOSLog] Starting iOS device log capture with: 'idevicesyslog'
2019-05-24 13:48:58:584 - [debug] [XCUITest] Crash reports root '/Users/device-farm/Library/Logs/CrashReporter/MobileDevice/9902472561' does not exist. Got nothing to gather.
2019-05-24 13:48:58:584 - [debug] [BaseDriver] Event 'logCaptureStarted' logged at 1558705738584 (06:48:58 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:48:58:584 - [XCUITest] Setting up real device
2019-05-24 13:48:58:585 - [debug] [XCUITest] Verifying application platform
2019-05-24 13:48:58:596 - [debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneOS"]
2019-05-24 13:49:01:091 - [debug] [XCUITest] Reset requested. Removing app with id 'some_bundle_id' from the device
2019-05-24 13:49:03:324 - [debug] [XCUITest] Installing '/tmp/2019424-464-d635jg.9mcjv/Payload/testProject.app' on device with UUID '4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0'...
2019-05-24 13:49:10:747 - [debug] [XCUITest] The app has been installed successfully.
2019-05-24 13:49:10:748 - [debug] [BaseDriver] Event 'appInstalled' logged at 1558705750748 (06:49:10 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:49:10:750 - [XCUITest] Using WDA path: '/usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
2019-05-24 13:49:10:752 - [XCUITest] Using WDA agent: '/usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
2019-05-24 13:49:10:815 - [debug] [XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
2019-05-24 13:49:10:820 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:49:10:821 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:49:10:836 - [debug] [XCUITest] WDA is not listening at 'http://localhost:8100/'
2019-05-24 13:49:10:837 - [debug] [XCUITest] WDA is currently not running. There is nothing to cache
2019-05-24 13:49:10:837 - [debug] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
2019-05-24 13:49:10:838 - [debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1558705750838 (06:49:10 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:49:10:839 - [XCUITest] Launching WebDriverAgent on the device
2019-05-24 13:49:10:955 - [debug] [XCUITest] Carthage found: '/usr/local/bin/carthage'
2019-05-24 13:49:10:955 - [debug] [XCUITest] Running WebDriverAgent bootstrap script to install dependencies
2019-05-24 13:49:39:997 - [debug] [XCUITest] Creating WebDriverAgent resources directory
2019-05-24 13:49:39:998 - [debug] [XCUITest] Creating WebDriverAgent resource bundle directory
2019-05-24 13:49:39:999 - [debug] [XCUITest] Cleaning the project scheme 'WebDriverAgentLib' to make sure there are no leftovers from previous installs
2019-05-24 13:49:52:882 - [debug] [XCUITest] Cleaning the project scheme 'WebDriverAgentRunner' to make sure there are no leftovers from previous installs
2019-05-24 13:50:01:514 - [debug] [XCUITest] Killing running processes 'xcodebuild.*4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0, iproxy 8100' for the device 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0...
2019-05-24 13:50:01:602 - [debug] [XCUITest] 'pgrep -nif xcodebuild.*4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0' didn't detect any matching processes. Return code: 1
2019-05-24 13:50:01:655 - [debug] [XCUITest] 'pgrep -nif iproxy 8100' didn't detect any matching processes. Return code: 1
2019-05-24 13:50:01:655 - [debug] [XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB for the device 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:50:06:818 - [XCUITest] Cannot parse major and minor version numbers from platformVersion "null". Will build for the default platform instead
2019-05-24 13:50:06:819 - [debug] [XCUITest] Beginning test with command 'xcodebuild test-without-building -project /usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /tmp/scratchmfswDs.scratch/DerivedData1JgqWF -destination id=4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0' in directory '/usr/local/avm/versions/1.9.1/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
2019-05-24 13:50:06:820 - [debug] [XCUITest] Output from xcodebuild will not be logged. To change this, use 'showXcodeLog' desired capability
2019-05-24 13:50:10:188 - [debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
2019-05-24 13:50:10:188 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:10:189 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:11:340 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:11:340 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:12:380 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:12:380 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:13:433 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:13:433 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:14:477 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:14:478 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:15:508 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:15:509 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:15:750 - [debug] [XCUITest] Log file for xcodebuild test: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF/Logs/Test/Test-WebDriverAgentRunner-2019.05.24_06-50-15--0700.xcresult/1_Test/Diagnostics/WebDriverAgentRunner-617486B3-34EB-4195-A160-0EF9A788792C/WebDriverAgentRunner-1E30900B-8D08-41D1-8C4E-7D02A3E9CDB5/Session-WebDriverAgentRunner-2019-05-24_065015-ghzVbu.log
2019-05-24 13:50:16:571 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'

2019-05-24 13:50:34:240 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:35:284 - [debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
2019-05-24 13:50:35:285 - [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
2019-05-24 13:50:35:361 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"state\" : \"success\",\n    \"os\" : {\n      \"name\" : \"iOS\",\n      \"version\" : \"12.0\",\n      \"sdkVersion\" : \"12.0\"\n    },\n    \"ios\" : {\n      \"simulatorVersion\" : \"12.0\",\n      \"ip\" : \"192.168.1.10\"\n    },\n    \"build\" : {\n      \"upgradedAt\" : \"1558705779000\",\n      \"time\" : \"Nov 29 2018 13:42:57\",\n      \"productBundleIdentifier\" : \"com.facebook.WebDriverAgentRunner\"\n    }\n  },\n  \"sessionId\" : \"2C9B264F-15B5-4C9B-84AE-A19F79EE11B1\",\n  \"status\" : 0\n}"
2019-05-24 13:50:35:363 - [debug] [XCUITest] WebDriverAgent information:
2019-05-24 13:50:35:364 - [debug] [XCUITest] {
2019-05-24 13:50:35:364 - [debug] [XCUITest]   "state": "success",
2019-05-24 13:50:35:364 - [debug] [XCUITest]   "os": {
2019-05-24 13:50:35:364 - [debug] [XCUITest]     "name": "iOS",
2019-05-24 13:50:35:364 - [debug] [XCUITest]     "version": "12.0",
2019-05-24 13:50:35:364 - [debug] [XCUITest]     "sdkVersion": "12.0"
2019-05-24 13:50:35:364 - [debug] [XCUITest]   },
2019-05-24 13:50:35:365 - [debug] [XCUITest]   "ios": {
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "simulatorVersion": "12.0",
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "ip": "192.168.1.10"
2019-05-24 13:50:35:365 - [debug] [XCUITest]   },
2019-05-24 13:50:35:365 - [debug] [XCUITest]   "build": {
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "upgradedAt": "1558705779000",
2019-05-24 13:50:35:365 - [debug] [XCUITest]     "time": "Nov 29 2018 13:42:57",
2019-05-24 13:50:35:366 - [debug] [XCUITest]     "productBundleIdentifier": "com.facebook.WebDriverAgentRunner"
2019-05-24 13:50:35:366 - [debug] [XCUITest]   }
2019-05-24 13:50:35:366 - [debug] [XCUITest] }
2019-05-24 13:50:35:366 - [debug] [XCUITest] WebDriverAgent successfully started after 28545ms
2019-05-24 13:50:35:367 - [debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1558705835367 (06:50:35 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:35:368 - [debug] [XCUITest] Sending createSession command to WDA
2019-05-24 13:50:35:369 - [debug] [JSONWP Proxy] Matched '/session' to command name 'createSession'
2019-05-24 13:50:35:370 - [debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"some_bundle_id","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
2019-05-24 13:50:37:324 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","capabilities":{"device":"iphone","browserName":"My Test Project","sdkVersion":"12.0","CFBundleIdentifier":"some_bundle_id"}},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":0}
2019-05-24 13:50:37:324 - [debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1558705837324 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:324 - [debug] [BaseDriver] Event 'wdaStarted' logged at 1558705837324 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:325 - [XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
2019-05-24 13:50:37:325 - [debug] [BaseDriver] Event 'orientationSet' logged at 1558705837325 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:326 - [Appium] New XCUITestDriver session created successfully, session 2b0a8f8e-26bc-4c58-9629-66f9f7fa338d added to master session list
2019-05-24 13:50:37:327 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1558705837327 (06:50:37 GMT-0700 (Pacific Daylight Time))
2019-05-24 13:50:37:328 - [debug] [W3C] Cached the protocol value 'W3C' for the new session 2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
2019-05-24 13:50:37:328 - [debug] [W3C] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","usePrebuiltWDA":true,"derivedDataPath":"/tmp/scratchmfswDs.scratch/DerivedData1JgqWF","automationName":"XCUITest","deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa","udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","bundleId":"some_bundle_id"}}
2019-05-24 13:50:37:332 - [HTTP] <-- POST /wd/hub/session 200 127747 ms - 629
2019-05-24 13:50:37:332 - [HTTP]
2019-05-24 13:50:37:517 - [HTTP] --> GET /wd/hub/session/2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
2019-05-24 13:50:37:517 - [HTTP] {}
2019-05-24 13:50:37:518 - [debug] [W3C] Calling AppiumDriver.getSession() with args: ["2b0a8f8e-26bc-4c58-9629-66f9f7fa338d"]
2019-05-24 13:50:37:519 - [debug] [XCUITest] Executing command 'getSession'
2019-05-24 13:50:37:530 - [debug] [JSONWP Proxy] Matched '/' to command name 'getSession'
2019-05-24 13:50:37:530 - [debug] [JSONWP Proxy] Proxying [GET /] to [GET http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E] with no body
2019-05-24 13:50:37:615 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n    \"capabilities\" : {\n      \"device\" : \"iphone\",\n      \"browserName\" : \"My Test Project\",\n      \"sdkVersion\" : \"12.0\",\n      \"CFBundleIdentifier\" : \"some_bundle_id\"\n    }\n  },\n  \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n  \"status\" : 0\n}"
2019-05-24 13:50:37:635 - [debug] [JSONWP Proxy] Proxying [GET /wda/screen] to [GET http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/wda/screen] with no body
2019-05-24 13:50:37:869 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"statusBarSize\" : {\n      \"width\" : 375,\n      \"height\" : 20\n    },\n    \"scale\" : 2\n  },\n  \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n  \"status\" : 0\n}"
2019-05-24 13:50:37:872 - [debug] [JSONWP Proxy] Proxying [GET /window/size] to [GET http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/window/size] with no body
2019-05-24 13:50:38:006 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"width\" : 375,\n    \"height\" : 667\n  },\n  \"sessionId\" : \"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E\",\n  \"status\" : 0\n}"
2019-05-24 13:50:38:007 - [XCUITest] Merging WDA caps over Appium caps for session detail response
2019-05-24 13:50:38:009 - [debug] [W3C] Responding to client with driver.getSession() result: {"udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","platformName":"ios","usePrebuiltWDA":true,"derivedDataPath":"/tmp/scratchmfswDs.scratch/DerivedData1JgqWF","automationName":"XCUITest","deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa","bundleId":"some_bundle_id","device":"iphone","browserName":"My Test Project {","sdkVersion":"12.0","CFBundleIdentifier":"some_bundle_id","pixelRatio":2,"statBarHeight":20,"viewportRect":{"left":0,"top":40,"width":750,"height":1294}}
2019-05-24 13:50:38:044 - [HTTP] <-- GET /wd/hub/session/2b0a8f8e-26bc-4c58-9629-66f9f7fa338d 200 493 ms - 587
2019-05-24 13:50:38:044 - [HTTP]
2019-05-24 13:50:38:046 - [HTTP] --> GET /wd/hub/session/2b0a8f8e-26bc-4c58-9629-66f9f7fa338d
2019-05-24 13:50:38:046 - [HTTP] {}
2019-05-24 13:50:38:047 - [debug] [W3C] Calling AppiumDriver.getSession() with args: ["2b0a8f8e-26bc-4c58-9629-66f9f7fa338d"]
2019-05-24 13:50:38:047 - [debug] [XCUITest] Executing command 'getSession'
2019-05-24 13:50:38:049 - [XCUITest] Merging WDA caps over Appium caps for session detail response
2019-05-24 13:50:38:050 - [debug] [W3C] Responding to client with driver.getSession() result: {"udid":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","platformName":"ios","usePrebuiltWDA":true,"derivedDataPath":"/tmp/scratchmfswDs.scratch/DerivedData1JgqWF","automationName":"XCUITest","deviceName":"4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0","app":"/tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa","bundleId":"some_bundle_id","device":"iphone","browserName":"My Test Project","sdkVersion":"12.0","CFBundleIdentifier":"some_bundle_id","pixelRatio":2,"statBarHeight":20,"viewportRect":{"left":0,"top":40,"width":750,"height":1294}}
2019-05-24 13:50:52:923 - [HTTP] {"using":"id","value":"testInput"}
2019-05-24 13:50:52:924 - [debug] [W3C] Calling AppiumDriver.findElement() with args: ["id","testInput","2b0a8f8e-26bc-4c58-9629-66f9f7fa338d"]
2019-05-24 13:50:52:924 - [debug] [XCUITest] Executing command 'findElement'
2019-05-24 13:50:52:925 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2019-05-24 13:50:52:925 - [debug] [BaseDriver] Waiting up to 6000000 ms for condition
2019-05-24 13:50:52:926 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:52:926 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:53:129 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:53:130 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:53:130 - [debug] [BaseDriver] Waited for 205 ms so far
2019-05-24 13:50:53:709 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:53:710 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:53:923 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:53:924 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:53:924 - [debug] [BaseDriver] Waited for 999 ms so far
2019-05-24 13:50:54:442 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:54:442 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:54:635 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:54:636 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:54:636 - [debug] [BaseDriver] Waited for 1711 ms so far
2019-05-24 13:50:55:277 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:55:277 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:55:491 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:55:491 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:55:491 - [debug] [BaseDriver] Waited for 2566 ms so far
2019-05-24 13:50:55:991 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:55:992 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:56:155 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:56:155 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
2019-05-24 13:50:56:156 - [debug] [BaseDriver] Waited for 3231 ms so far
2019-05-24 13:50:56:701 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:56:702 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:56:913 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:56:913 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError

Body:
Thanks for posting those logs! It looks like the capabilities are valid(though the bundle id is obviously not valid). The bundleId will automatically be taken from the ipa file so it shouldn't be necessary to provide that if we also have the app capability.

http://appium.io/docs/en/writing-running-appium/caps/#ios-only

Bundle ID of the app under test. Useful for starting an app on a real device or for using other caps which require the bundle ID during test startup. To run a test on a real device using the bundle ID, you may omit the 'app' capability, but you must provide 'udid'.

The default capabilities required for the app to start should be already provided by the default appium server CLI command in the testspec.yml file.

appium --log-timestamp --device-name $DEVICEFARM_DEVICE_NAME --platform-name $DEVICEFARM_DEVICE_PLATFORM_NAME --app $DEVICEFARM_APP_PATH --udid $DEVICEFARM_DEVICE_UDID --automation-name XCUITest --default-capabilities "{\"usePrebuiltWDA\": true, \"derivedDataPath\":\"$DEVICEFARM_WDA_DERIVED_DATA_PATH_V1\"}" >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &

Capabilities

2019-05-24 13:48:29:597 - [Appium] Creating new XCUITestDriver (v2.94.2) session
2019-05-24 13:48:29:597 - [Appium] Capabilities:
2019-05-24 13:48:29:597 - [Appium]   platformName: ios
2019-05-24 13:48:29:597 - [Appium]   usePrebuiltWDA: true
2019-05-24 13:48:29:597 - [Appium]   derivedDataPath: /tmp/scratchmfswDs.scratch/DerivedData1JgqWF
2019-05-24 13:48:29:598 - [Appium]   automationName: XCUITest
2019-05-24 13:48:29:598 - [Appium]   deviceName: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   app: /tmp/scratchmfswDs.scratch/share-djkVWj.scratch/app-A1XQ83.ipa
2019-05-24 13:48:29:598 - [Appium]   udid: 4aeaf84dd2abb30c8b5474b0fa1a9c925c9df7c0
2019-05-24 13:48:29:598 - [Appium]   bundleId: some_bundle_id

Since the error, in this case, is regarding how to find an element I would think the best thing to do for that is to print the page source and first confirm that the element is there. You can also do this using a capability which will print the page source when the script errors.

http://appium.io/docs/en/writing-running-appium/caps/#general-capabilities

printPageSourceOnFindFailure  When a find operation fails, print the current page source. Defaults to false.  e.g., true

Appium server log snippet

2019-05-24 13:50:56:701 - [debug] [JSONWP Proxy] Matched '/element' to command name 'findElement'
2019-05-24 13:50:56:702 - [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E/element] with body: {"using":"id","value":"testInput"}
2019-05-24 13:50:56:913 - [debug] [JSONWP Proxy] Got response with status 200: {"value":{"using":"id","value":"testInput","description":"unable to find an element"},"sessionId":"5CDDA2BB-9B89-4359-8E8B-F8F3B99AE45E","status":7}
2019-05-24 13:50:56:913 - [debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError

Can you print the page source and follow up with the result?

HTH

-James


来源: stackexchange

问:
Map property with corresponding value in another property
I have a function that gets the LCID (locale ID) from the current user. I want to map this number with the corresponding language in another property. For example, I  first extract the LCID from the user, let's say "1043" for Dutch. I have a property with "1043: Dutch" and I want to extract the name from this property with the ID.

My code:

```<code>export class Languages {
  public static languages = {
    1033: 'English',
    1035: 'Finnish',
    1036: 'French',
    1037: 'Hebrew',
    1038: 'Hungarian',
    1040: 'Italian',
    1041: 'Japanese',
    1042: 'Korean',
    1043: 'Dutch',
    1044: 'Norwegian',
    1045: 'Polish',
  };
}

localeId = applicationContext.pageContext.legacyPageContext.currentLanguage; //get the LCID
}

let language: any;

const pos: number = Object.keys(Languages.languages).indexOf(localeId.toString());
//WRONG BELOW
if (pos > -1) {

  let languageObject = Object.keys(Languages.languages).map(e => Languages.languages[pos]);
  language = languageObject;

  //WRONG UP
}

return language; //Should return the correct NAME of the languages via the ID
}
</code>```

See the code where I wrote, "wrong below". It doesn't return the correct value. For example, if the localeId is 1043, then it would return "Dutch" which it doesn't.

答:
```<code>public static languages = {
    1033: 'English',
   .....etc
  };
</code>```

if the above code is in the format of localeId: Language Name.
you can access directly like Languages[localeId]

ContentLicense: CC BY-SA 4.0

Body:
I have a function that gets the LCID (locale ID) from the current user. I want to map this number with the corresponding language in another property. For example, I  first extract the LCID from the user, let's say "1043" for Dutch. I have a property with "1043: Dutch" and I want to extract the name from this property with the ID.

My code:

export class Languages {
  public static languages = {
    1033: 'English',
    1035: 'Finnish',
    1036: 'French',
    1037: 'Hebrew',
    1038: 'Hungarian',
    1040: 'Italian',
    1041: 'Japanese',
    1042: 'Korean',
    1043: 'Dutch',
    1044: 'Norwegian',
    1045: 'Polish',
  };
}

localeId = applicationContext.pageContext.legacyPageContext.currentLanguage; //get the LCID
}

let language: any;

const pos: number = Object.keys(Languages.languages).indexOf(localeId.toString());
//WRONG BELOW
if (pos > -1) {

  let languageObject = Object.keys(Languages.languages).map(e => Languages.languages[pos]);
  language = languageObject;

  //WRONG UP
}

return language; //Should return the correct NAME of the languages via the ID
}

See the code where I wrote, "wrong below". It doesn't return the correct value. For example, if the localeId is 1043, then it would return "Dutch" which it doesn't.

Body:
public static languages = {
    1033: 'English',
   .....etc
  };

if the above code is in the format of localeId: Language Name.
you can access directly like Languages[localeId]


问:
I was trying to complete a palindrome-check but reverse variable is not having the expected value
The following code should perform a check if the number provided by a user is palindrome or not, but the code in while loop reverse is always not equal to the number even when I enter 12321 as a value.

```<code>number=input("Type the number:")

temp=number
reverse=0
reminder=0

while temp!=0 :
      reminder=int(temp)%10
      reverse=reverse*10+reminder
      temp=int(temp)/10

if reverse==number :
      print("this is a palindrome number")
else:
      print("this is not a palindrome number")
</code>```

答:
i would change the line for the temp
temp=int(int(temp)/10)

and I would also ask whether int(number)== int(reverse)

Body:
The following code should perform a check if the number provided by a user is palindrome or not, but the code in while loop reverse is always not equal to the number even when I enter 12321 as a value.

number=input("Type the number:")

temp=number
reverse=0
reminder=0

while temp!=0 :
      reminder=int(temp)%10
      reverse=reverse*10+reminder
      temp=int(temp)/10

if reverse==number :
      print("this is a palindrome number")
else:
      print("this is not a palindrome number")


问:
Finding the array with the lowest max value of element
I have an arraylist of int[] arrays and I'm trying to find the array with the lowest max element.

For an example, from arrays [1,2,5], [0,1,2], [8,0,0] it would be the array [0,1,2] because the max element is 2.

However, my code is not working correctly. Could you help me fix my code? Thanks!

```<code>int min = Integer.MAX_VALUE;
for (int i=0; i<list.size(); i++) {
    for (int j=0; j<list.get(i).length; j++) {
        if (list.get(i)[j]<min) {
            min = list.get(i)[i];
            minIndex = i; //index of the array in arraylist
        }
    }
}
</code>```

答:
Your code finds the lowest value across all arrays (at least it would if you fix the typo of list.get(i)[i] to list.get(i)[j]).

You should find the maximum element of each array, and then check if that maximum is smaller than all the previously found maximums:

```<code>int minIndex = 0;
int min = Integer.MAX_VALUE;
for (int i=0; i<list.size(); i++) {
    int max = Integer.MIN_VALUE;
    for (int j=0; j<list.get(i).length; j++) { // find max element of current array
        if (list.get(i)[j] > max) {
            max = list.get(i)[j];
            if (max > min) {
                break; // we already know the max of this array is not the smallest max
            }
        }
    }
    if (max < min) { // check if the max of the current array is the smallest max so far
        min = max;
        minIndex = i; //index of the array in arraylist
    }
}
</code>```

Body:
I have an arraylist of int[] arrays and I'm trying to find the array with the lowest max element.

For an example, from arrays [1,2,5], [0,1,2], [8,0,0] it would be the array [0,1,2] because the max element is 2.

However, my code is not working correctly. Could you help me fix my code? Thanks!

int min = Integer.MAX_VALUE;
for (int i=0; i<list.size(); i++) {
    for (int j=0; j<list.get(i).length; j++) {
        if (list.get(i)[j]<min) {
            min = list.get(i)[i];
            minIndex = i; //index of the array in arraylist
        }
    }
}

Body:
Your code finds the lowest value across all arrays (at least it would if you fix the typo of list.get(i)[i] to list.get(i)[j]).

You should find the maximum element of each array, and then check if that maximum is smaller than all the previously found maximums:

int minIndex = 0;
int min = Integer.MAX_VALUE;
for (int i=0; i<list.size(); i++) {
    int max = Integer.MIN_VALUE;
    for (int j=0; j<list.get(i).length; j++) { // find max element of current array
        if (list.get(i)[j] > max) {
            max = list.get(i)[j];
            if (max > min) {
                break; // we already know the max of this array is not the smallest max
            }
        }
    }
    if (max < min) { // check if the max of the current array is the smallest max so far
        min = max;
        minIndex = i; //index of the array in arraylist
    }
}


问:
Parse business hours Time Slots and Week Days from JSON array with PHP
Can't figure out how to properly parse a JSON array with PHP.

In my script, I have a foreach statement that parses a local JSON file, extract data and insert it on the database.

Everything is ok except the parsing of the week and business hours.

This is what i've done:

```<code>$openingHours = $json_data['openingHours'];
</code>```

every json file may return an array with different rows like in this output:

```<code>example 1:
"openingHours" : [
"Su 09:00 - 23:59",
"Mo 00:00 - 23:59",
"Tu 00:00 - 13:00, 15:30 - 19:30",
"We 08:30 - 13:00, 15:30 - 19:30",
"Th 08:30 - 13:00, 15:30 - 19:30",
"Fr 08:30 - 13:00, 15:30 - 19:30",
"Sa 08:30 - 13:00, 15:30 - 19:30" ]

 exampe 2:
"openingHours" : [
"Mo 08:00 - 13:00, 16:00 - 20:00",
"Tu 08:00 - 13:00, 16:00 - 20:00",
"We 08:00 - 13:00, 16:00 - 20:00",
"Th 08:00 - 13:00, 16:00 - 20:00",
"Fr 08:00 - 13:00, 16:00 - 20:00",
"Sa 08:00 - 13:00, 16:00 - 20:00" ]

 example 3:
 "openingHours" : [
"Mo 08:00 - 13:00, 16:00 - 20:00",
"We 08:00 - 13:00, 16:00 - 20:00",
"Th 08:00 - 13:00, 16:00 - 20:00",
"Sa 08:00 - 13:00, 16:00 - 20:00" ]
</code>```

As you can see, in the first json I have all 7 days, on the second example there are 6 days from Monday to Saturday, and in the third example there are 4 days Mo-We-Th-Sa

So I'm going to create a foreach statement to output the data;

```<code>foreach ($openingHours as $k_day=>$v_day) {

    $openHrs = $openingHours[$k_day];
    echo print_r($openHrs)."<br>";

}
</code>```

it produce an output like this:

```<code>FILE 1:
Mo 08:30 - 12:30, 16:00 - 20:00
Tu 08:30 - 12:30, 16:00 - 20:00
We 08:30 - 12:30, 16:00 - 20:00
Th 16:00 - 20:00
Fr 08:30 - 12:30, 16:00 - 20:00
Sa 08:30 - 12:30, 16:00 - 20:00

FILE 2:
Su 09:00 - 23:59
Mo 00:00 - 23:59
Tu 00:00 - 13:00, 15:30 - 19:30
We 08:30 - 13:00, 15:30 - 19:30
Th 08:30 - 13:00, 15:30 - 19:30
Sa 08:30 - 13:00, 15:30 - 19:30

FILE N:
.....
</code>```

At this point i need to create some rules to properly format and extract days and business hours from array.

First of all I have to declare days of the week that start from Sunday

```<code>0 - Su
1 - Mo
2 - Tu
3 - We
4 - Th
5 - Fr
6 - Sa
</code>```

Then, check if there all week string (Su - Mo -Tu...) in array and if some day is missing, add them to the list in a correct position.

As in this example

```<code>"openingHours" : [
"Mo 08:00 - 13:00, 16:00 - 20:00",
"We 08:00 - 13:00",
"Th 08:00 - 13:00, 16:00 - 20:00",
"Sa 08:00 - 13:00, 16:00 - 20:00" ]
</code>```

the days: Su - Tu - Fr, doesn't exist (it means that in these days the Shop is closed).

On "Wednesday" it's open only from 08:00 to 13:00, and the 3rd and 4th-time slots don't exist. It means that I need to insert 2-time slots.
Obviously for closed days i need to insert the time slots too ("00:00 - 00:00, 00:00 - 00:00").

```<code>0 - <-- insert
1 - Mo
2 - <-- insert
3 - We --> add "00:00 - 00:00"
4 - Th
5 - <-- insert
6 - Sa
</code>```

Summing up,
all days rows and their slots must be populated with proper data.

At the last point, before pass the data to the database, I need the properly parameterize variables.

This is mine CREATE TABLE statement of the table where i want to put data:

```<code>CREATE TABLE `business_hours_temp` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`place_id` INT(11) NOT NULL,
`day` INT(1) NOT NULL,
`open_1` TIME NOT NULL,
`close_1` TIME NOT NULL,
`open_2` TIME NOT NULL,
`close_2` TIME NOT NULL,
PRIMARY KEY (`id`),
INDEX `place_id` (`place_id`)
)
 COLLATE='utf8mb4_unicode_ci'
 ENGINE=InnoDB
 AUTO_INCREMENT=12;
</code>```

and this is an INSERT INTO statement

```<code>$stmt_hours = $conn->prepare(
    'INSERT INTO business_hours_temp( place_id, day, open_1, close_1, open_2, close_2 )
     VALUES(:place_id, :field_id, :field_value)');
$stmt_hours->bindValue(':place_id', $place_id);
$stmt_hours->bindValue(':day', $day);
$stmt_hours->bindValue(':open_1', $open_1);
$stmt_hours->bindValue(':close_1', $close_1);
$stmt_hours->bindValue(':open_2', $open_2);
$stmt_hours->bindValue(':close_2', $close_2);
$stmt_hours->execute();
</code>```

I need to get vals for $day - $open_1 - $close_1 - $open_2 - $close_2

Thank you guys for any help.

Body:
Can't figure out how to properly parse a JSON array with PHP.

In my script, I have a foreach statement that parses a local JSON file, extract data and insert it on the database.

Everything is ok except the parsing of the week and business hours.

This is what i've done:

$openingHours = $json_data['openingHours'];

every json file may return an array with different rows like in this output:

example 1:
"openingHours" : [
"Su 09:00 - 23:59",
"Mo 00:00 - 23:59",
"Tu 00:00 - 13:00, 15:30 - 19:30",
"We 08:30 - 13:00, 15:30 - 19:30",
"Th 08:30 - 13:00, 15:30 - 19:30",
"Fr 08:30 - 13:00, 15:30 - 19:30",
"Sa 08:30 - 13:00, 15:30 - 19:30" ]

 exampe 2:
"openingHours" : [
"Mo 08:00 - 13:00, 16:00 - 20:00",
"Tu 08:00 - 13:00, 16:00 - 20:00",
"We 08:00 - 13:00, 16:00 - 20:00",
"Th 08:00 - 13:00, 16:00 - 20:00",
"Fr 08:00 - 13:00, 16:00 - 20:00",
"Sa 08:00 - 13:00, 16:00 - 20:00" ]

 example 3:
 "openingHours" : [
"Mo 08:00 - 13:00, 16:00 - 20:00",
"We 08:00 - 13:00, 16:00 - 20:00",
"Th 08:00 - 13:00, 16:00 - 20:00",
"Sa 08:00 - 13:00, 16:00 - 20:00" ]

As you can see, in the first json I have all 7 days, on the second example there are 6 days from Monday to Saturday, and in the third example there are 4 days Mo-We-Th-Sa

So I'm going to create a foreach statement to output the data;

foreach ($openingHours as $k_day=>$v_day) {

    $openHrs = $openingHours[$k_day];
    echo print_r($openHrs)."
";

}

it produce an output like this:

FILE 1:
Mo 08:30 - 12:30, 16:00 - 20:00
Tu 08:30 - 12:30, 16:00 - 20:00
We 08:30 - 12:30, 16:00 - 20:00
Th 16:00 - 20:00
Fr 08:30 - 12:30, 16:00 - 20:00
Sa 08:30 - 12:30, 16:00 - 20:00

FILE 2:
Su 09:00 - 23:59
Mo 00:00 - 23:59
Tu 00:00 - 13:00, 15:30 - 19:30
We 08:30 - 13:00, 15:30 - 19:30
Th 08:30 - 13:00, 15:30 - 19:30
Sa 08:30 - 13:00, 15:30 - 19:30

FILE N:
.....

At this point i need to create some rules to properly format and extract days and business hours from array.

First of all I have to declare days of the week that start from Sunday

0 - Su
1 - Mo
2 - Tu
3 - We
4 - Th
5 - Fr
6 - Sa

Then, check if there all week string (Su - Mo -Tu...) in array and if some day is missing, add them to the list in a correct position.

As in this example

"openingHours" : [
"Mo 08:00 - 13:00, 16:00 - 20:00",
"We 08:00 - 13:00",
"Th 08:00 - 13:00, 16:00 - 20:00",
"Sa 08:00 - 13:00, 16:00 - 20:00" ]

the days: Su - Tu - Fr, doesn't exist (it means that in these days the Shop is closed).

On "Wednesday" it's open only from 08:00 to 13:00, and the 3rd and 4th-time slots don't exist. It means that I need to insert 2-time slots.
Obviously for closed days i need to insert the time slots too ("00:00 - 00:00, 00:00 - 00:00").

0 - <-- insert
1 - Mo
2 - <-- insert
3 - We --> add "00:00 - 00:00"
4 - Th
5 - <-- insert
6 - Sa

Summing up,
all days rows and their slots must be populated with proper data.

At the last point, before pass the data to the database, I need the properly parameterize variables.

This is mine CREATE TABLE statement of the table where i want to put data:

CREATE TABLE `business_hours_temp` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`place_id` INT(11) NOT NULL,
`day` INT(1) NOT NULL,
`open_1` TIME NOT NULL,
`close_1` TIME NOT NULL,
`open_2` TIME NOT NULL,
`close_2` TIME NOT NULL,
PRIMARY KEY (`id`),
INDEX `place_id` (`place_id`)
)
 COLLATE='utf8mb4_unicode_ci'
 ENGINE=InnoDB
 AUTO_INCREMENT=12;

and this is an INSERT INTO statement

$stmt_hours = $conn->prepare(
    'INSERT INTO business_hours_temp( place_id, day, open_1, close_1, open_2, close_2 )
     VALUES(:place_id, :field_id, :field_value)');
$stmt_hours->bindValue(':place_id', $place_id);
$stmt_hours->bindValue(':day', $day);
$stmt_hours->bindValue(':open_1', $open_1);
$stmt_hours->bindValue(':close_1', $close_1);
$stmt_hours->bindValue(':open_2', $open_2);
$stmt_hours->bindValue(':close_2', $close_2);
$stmt_hours->execute();

I need to get vals for $day - $open_1 - $close_1 - $open_2 - $close_2

Thank you guys for any help.

Body:
<?php

$openingHours1 = [
    "Su 09:00 - 23:59",
    "Mo 00:00 - 23:59",
    "Tu 00:00 - 13:00, 15:30 - 19:30",
    "We 08:30 - 13:00, 15:30 - 19:30",
    "Th 08:30 - 13:00, 15:30 - 19:30",
    "Fr 08:30 - 13:00, 15:30 - 19:30",
    "Sa 08:30 - 13:00, 15:30 - 19:30" ];

$openingHours3 = [
    "Mo 08:00 - 13:00, 16:00 - 20:00",
    "We 08:00 - 13:00, 16:00 - 20:00",
    "Th 08:00 - 13:00, 16:00 - 20:00",
    "Sa 08:00 - 13:00, 16:00 - 20:00" ];

$openingHours2 = [
    "Mo 08:00 - 13:00, 16:00 - 20:00",
    "Tu 08:00 - 13:00, 16:00 - 20:00",
    "We 08:00 - 13:00, 16:00 - 20:00",
    "Th 08:00 - 13:00, 16:00 - 20:00",
    "Fr 08:00 - 13:00, 16:00 - 20:00",
    "Sa 08:00 - 13:00, 16:00 - 20:00" ];

function parse($openingHours)
{
    $resultList = [];

    $daysLut = [
        'Su' => 0,
        'Mo' => 1,
        'Tu' => 2,
        'We' => 3,
        'Th' => 4,
        'Fr' => 5,
        'Sa' => 6,
    ];

    $counter = 0;
    $dayNoLut = [];

    foreach ($openingHours as $oppening) {
        $open1 = null;
        $open2 = null;

        $dayLetter = substr($oppening, 0, 2);
        $dayNo = $daysLut[$dayLetter];

        $open1 = substr($oppening, 3, 13);

        if(strlen($oppening) > 18) {
            $open2 = substr($oppening, 18);
        }

        if(empty($open2)) {
            $open2 = "00:00 - 00:00";
        }

        $result['dayNo'] = $dayNo;
        $result['open1'] = $open1;
        $result['open2'] = $open2;

        $dayNoLut[$dayNo] = $counter;

        $resultList[] = $result;
        $counter++;
    }

    $resultFilledList = [];
    $resultListCount = count($resultList);
    if($resultListCount < 7) {
        $result = [];
        $result['open1'] = "00:00 - 00:00";

        //remove this line if for a cloed day you want only one 00:00 - 00:00
        $result['open2'] = "00:00 - 00:00";

        for($i=0; $i<7; $i++) {
            $result['dayNo'] = $i;

            if(key_exists($i, $dayNoLut)) {
                $resultFilledList[$i] = $resultList[$dayNoLut[$i]];
            } else {
                $resultFilledList[$i] = $result;
            }
        }
    } else {
        $resultFilledList = $resultList;
    }

    return $resultFilledList;

}

$resultFilledList = parse($openingHours3);
print_r($resultFilledList);

$daysLut2 = [
    0 => 'Su',
    1 => 'Mo',
    2 => 'Tu',
    3 => 'We',
    4 => 'Th',
    5 => 'Fr',
    6 => 'Sa',
];

$lineList = [];
foreach($resultFilledList as $result) {
    $line = '';
    $line .= $daysLut2[$result['dayNo']];
    $line .= ' ' . $result['open1'];
    $line .= ', ' . $result['open2'];

    $lineList[] = $line;
}

print_r($lineList);

$lineList = [];
foreach($resultFilledList as $result) {
    $line = '';

    $line = $result['dayNo'];
    $line .= ' - ';

    $line .= $daysLut2[$result['dayNo']];
    $line .= ' ' . $result['open1'];
    $line .= ', ' . $result['open2'];

    $lineList[] = $line;
}

print_r($lineList);

gives output:

Array
(
    [0] => Array
        (
            [open1] => 00:00 - 00:00
            [open2] => 00:00 - 00:00
            [dayNo] => 0
        )

    [1] => Array
        (
            [dayNo] => 1
            [open1] => 08:00 - 13:00
            [open2] => 16:00 - 20:00
        )

    [2] => Array
        (
            [open1] => 00:00 - 00:00
            [open2] => 00:00 - 00:00
            [dayNo] => 2
        )

    [3] => Array
        (
            [dayNo] => 3
            [open1] => 08:00 - 13:00
            [open2] => 16:00 - 20:00
        )

    [4] => Array
        (
            [dayNo] => 4
            [open1] => 08:00 - 13:00
            [open2] => 16:00 - 20:00
        )

    [5] => Array
        (
            [open1] => 00:00 - 00:00
            [open2] => 00:00 - 00:00
            [dayNo] => 5
        )

    [6] => Array
        (
            [dayNo] => 6
            [open1] => 08:00 - 13:00
            [open2] => 16:00 - 20:00
        )

)
Array
(
    [0] => Su 00:00 - 00:00, 00:00 - 00:00
    [1] => Mo 08:00 - 13:00, 16:00 - 20:00
    [2] => Tu 00:00 - 00:00, 00:00 - 00:00
    [3] => We 08:00 - 13:00, 16:00 - 20:00
    [4] => Th 08:00 - 13:00, 16:00 - 20:00
    [5] => Fr 00:00 - 00:00, 00:00 - 00:00
    [6] => Sa 08:00 - 13:00, 16:00 - 20:00
)
Array
(
    [0] => 0 - Su 00:00 - 00:00, 00:00 - 00:00
    [1] => 1 - Mo 08:00 - 13:00, 16:00 - 20:00
    [2] => 2 - Tu 00:00 - 00:00, 00:00 - 00:00
    [3] => 3 - We 08:00 - 13:00, 16:00 - 20:00
    [4] => 4 - Th 08:00 - 13:00, 16:00 - 20:00
    [5] => 5 - Fr 00:00 - 00:00, 00:00 - 00:00
    [6] => 6 - Sa 08:00 - 13:00, 16:00 - 20:00
)

just use

$resultFilledList = parse($openingHours3);

where oppeningHours3 is an array. so if you have it in json use $openingHours3 = json_decode($data, true);,

and then

print it or iterate over it with foreach loop as I did in my code.


问:
How use a ViewModel & LiveData observer in multiple Activity?
I developed an App by MVVM pattern and google jetpack dependencies.
I have a SampleViewModel that has a method that I need it observer.
I have two View called FActivity and SActivity, for firstly I created instance SampleViewModel in FActivity and subscribe observer to LiveData by ViewModel:

```<code>class FActivity : Acivity{
   onCreate(){
      val vm = ViewModelsProviders
              .of(this)
              .get(SampleViewModel::class.java)

         vm.liveData.observe(this, Observer { basic ->
                Log.i("TAG", "Yes I received from SActivity");
         });)
   }
}
</code>```

now, I will do operation enqueue() method in SActivity and observer to FActivity

```<code>class SActivity : Acivity{
   onCreate(){
      val vm = ViewModelsProviders
              .of(this)
              .get(SampleViewModel::class.java)

         vm.enqueue();
}
</code>```

but I trace operation creating instance ViewModelProviders that renew instance ViewModel and no observe to FActivity.
Now, I will know best way what is handle?

答:
But no way for activities?

Correct. In Android Jetpack development, closely-coupled UI screens are supposed to be implemented as fragments, and they might share a common ViewModel. You are welcome to have multiple activities, but they should be very loosely coupled with other activities in the app, in cases where there would be no need for a shared ViewModel (e.g., the main activity and a "Help" screen activity).

Body:
I developed an App by MVVM pattern and google jetpack dependencies.
I have a SampleViewModel that has a method that I need it observer.
I have two View called FActivity and SActivity, for firstly I created instance SampleViewModel in FActivity and subscribe observer to LiveData by ViewModel:

class FActivity : Acivity{
   onCreate(){
      val vm = ViewModelsProviders
              .of(this)
              .get(SampleViewModel::class.java)

         vm.liveData.observe(this, Observer { basic ->
                Log.i("TAG", "Yes I received from SActivity");
         });)
   }
}

now, I will do operation enqueue() method in SActivity and observer to FActivity

class SActivity : Acivity{
   onCreate(){
      val vm = ViewModelsProviders
              .of(this)
              .get(SampleViewModel::class.java)

         vm.enqueue();
}

but I trace operation creating instance ViewModelProviders that renew instance ViewModel and no observe to FActivity.
Now, I will know best way what is handle?


问:
Saving timestamp in mysql table using php
I have a field in a MySQL table which has a timestamp data type. I am saving data into that table. But when I pass the timestamp (1299762201428) to the record, it automatically saves the value 0000-00-00 00:00:00 into that table.

How can I store the timestamp in a MySQL table?

Here is my INSERT statement:

```<code>INSERT INTO table_name (id,d_id,l_id,connection,s_time,upload_items_count,download_items_count,t_time,status)
VALUES (1,5,9,'2',1299762201428,5,10,20,'1'),
       (2,5,9,'2',1299762201428,5,10,20,'1')
</code>```

答: If the timestamp is the current time, you could use the mysql NOW() function

ContentLicense: CC BY-SA 3.0

Body:
I have a field in a MySQL table which has a timestamp data type. I am saving data into that table. But when I pass the timestamp (1299762201428) to the record, it automatically saves the value 0000-00-00 00:00:00 into that table.

How can I store the timestamp in a MySQL table?

Here is my INSERT statement:

INSERT INTO table_name (id,d_id,l_id,connection,s_time,upload_items_count,download_items_count,t_time,status)
VALUES (1,5,9,'2',1299762201428,5,10,20,'1'),
       (2,5,9,'2',1299762201428,5,10,20,'1')


问:
How to resolve in gradle transitive dependencies between services?
I am working in intellij, using spring boot and gradle.

I have a service that is using two other libraries and it seems I run into some problems with transitive dependencies.

The version of spring boot has updated in this service from 2.1.2 to 2.1.4 and that made the service not working anymore.

I am able to clean build this project in gradle just fine, but once I start it, at runtime I get...Could not resolve org.slf4j:slf4j-api:1.7.26.

I manually updated the slf4j dependency in the libraries from 1.7.25 to 1.7.26 as asked, but with little success.

If I run dependecies on this service I get what I think it is, to change the version to the right one:

```<code>|    +--- ch.qos.logback:logback-classic:1.2.3
|    |    +--- ch.qos.logback:logback-core:1.2.3
|    |    \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26
</code>```

but that might be a problem bcz that's a transitive dep of the logback classic. For this package on mvn I find that the slf4j api has been updated: https://mvnrepository.com/artifact/ch.qos.logback/logback-classic/1.2.3.

That was just one of them, if I search for all -> in the terminal I get 498 mathces, so it might be a problem to manually change all of them.

I've tried to delete .gradle folder from all projects, clean build, install but w/ no success.

答: It seems that it was some caching behind this. Clearing intelli cache, File -> Invalidate Caches/Restart... did the trick</p>

Body:
I am working in intellij, using spring boot and gradle.

I have a service that is using two other libraries and it seems I run into some problems with transitive dependencies.

The version of spring boot has updated in this service from 2.1.2 to 2.1.4 and that made the service not working anymore.

I am able to clean build this project in gradle just fine, but once I start it, at runtime I get...Could not resolve org.slf4j:slf4j-api:1.7.26.

I manually updated the slf4j dependency in the libraries from 1.7.25 to 1.7.26 as asked, but with little success.

If I run dependecies on this service I get what I think it is, to change the version to the right one:

|    +--- ch.qos.logback:logback-classic:1.2.3
|    |    +--- ch.qos.logback:logback-core:1.2.3
|    |    \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26

but that might be a problem bcz that's a transitive dep of the logback classic. For this package on mvn I find that the slf4j api has been updated: https://mvnrepository.com/artifact/ch.qos.logback/logback-classic/1.2.3.

That was just one of them, if I search for all -> in the terminal I get 498 mathces, so it might be a problem to manually change all of them.

I've tried to delete .gradle folder from all projects, clean build, install but w/ no success.


问:
Create both Async and Sync version of Dapper methods without duplicating the code?
Let's say I have a simple class which contains DB access methods. DB access goes over Dapper. What is the easiest way of creating async and sync versions of those methods without duplicating code? Let't take as an example there 2 methods: GetUsers() and GetUsersAsync(). In this case both methods would have the same logic. The only difference would be that, one would call sync and other async version of Dapper method, e.g. Query vs QueryAsync.

Just calling GetUsersAsync().Result is a bad idea. Has anyone solved this problem elegantly enough?

答:
A method in a data access layer (DAL) shouldn't contain much more logic than the actual query. You could define the query string and any parameters as private fields that both method can access, e.g.:

```<code>private const string ConnectionString = "...";
private const string Query = "SELECT Id, Name FROM Users";

public IEnumerable<User> GetUsers()
{
    using (var cn = new SqlConnection(ConnectionString))
        return cn.Query<SerieDailyValueDto>(Query).ToArray();
}

public Task<IEnumerable<User>> GetUsersAsync()
{
    using (var cn = new SqlConnection(ConnectionString))
        return await cn.QueryAsync<SerieDailyValueDto>(Query).ToArray();
}
</code>```

If you have any additional logic, you could implement it in a private method that both versions call prior to executing the query.

Body:
A method in a data access layer (DAL) shouldn't contain much more logic than the actual query. You could define the query string and any parameters as private fields that both method can access, e.g.:

private const string ConnectionString = "...";
private const string Query = "SELECT Id, Name FROM Users";

public IEnumerable<User> GetUsers()
{
    using (var cn = new SqlConnection(ConnectionString))
        return cn.Query<SerieDailyValueDto>(Query).ToArray();
}

public Task<IEnumerable<User>> GetUsersAsync()
{
    using (var cn = new SqlConnection(ConnectionString))
        return await cn.QueryAsync<SerieDailyValueDto>(Query).ToArray();
}

If you have any additional logic, you could implement it in a private method that both versions call prior to executing the query.


问:
How to use the same route with different query parameter
I have two conflicting endpoints:.

GET/phone? status=available; and

GET/phone? status=available &min_price=value &max_price=value;

My route is :

```<code>app.get('/phone', getAvailablePhones);

app.get('/phone', getAvailablePhonesbyPrice);
</code>```

Only the 1st route executes.

How do I use this route for both endpoints??

答:
You can not have two endpoints with the same name and the same parameters.

The query params are in the req.query object. You can use this object to filter the phones in the getAvailablePhones method.

For instance, if your params are min and max, you can get both values this way:

const { min, max } = req.query

And use both to filter your search

Body:
I have two conflicting endpoints:.

GET/phone? status=available; and

GET/phone? status=available &min_price=value &max_price=value;

My route is :

app.get('/phone', getAvailablePhones);

app.get('/phone', getAvailablePhonesbyPrice);

Only the 1st route executes.

How do I use this route for both endpoints??


问:
Does Flex 3 support threading?
Does Flex 3 support threading? If so, are there any examples or links I could look at?</p>

答:
ActionScript 3 is single-threaded.

What you can do is cut the work in slices small enough that the responsiveness is not too affected. For example:

```<code>private var _long_process_work_object:LongProcessWorkClass;
private var _long_process_timer:Timer;

private function startSomeLongAndIntensiveWork():void
{
    _long_process_work_object = new LongProcessWorkClass();

    _long_process_timer = new Timer(10);
    _long_process_timer.addEventListener("timer", longProcessTimerHandler);
    _long_process_timer.start();
}

private function longProcessTimerHandler(event:TimerEvent):void
{
    _long_process_timer.stop();

    // do the next slice of work:
    // you'll want to calibrate how much work a slice contains to maximize
    // performance while not affecting responsiveness excessively
    _long_process_work_object.doSomeOfTheWork();

    if (!_long_process_work_object.Done) {
        // long process is not done, start timer again
        _long_process_timer.start();
        return;
    }

    // long process work is done, do whatever comes after
}
</code>```

Title: Does Flex 3 support threading?

Body:
ActionScript 3 is single-threaded.

What you can do is cut the work in slices small enough that the responsiveness is not too affected. For example:

private var _long_process_work_object:LongProcessWorkClass;
private var _long_process_timer:Timer;

private function startSomeLongAndIntensiveWork():void
{
    _long_process_work_object = new LongProcessWorkClass();

    _long_process_timer = new Timer(10);
    _long_process_timer.addEventListener("timer", longProcessTimerHandler);
    _long_process_timer.start();
}

private function longProcessTimerHandler(event:TimerEvent):void
{
    _long_process_timer.stop();

    // do the next slice of work:
    // you'll want to calibrate how much work a slice contains to maximize
    // performance while not affecting responsiveness excessively
    _long_process_work_object.doSomeOfTheWork();

    if (!_long_process_work_object.Done) {
        // long process is not done, start timer again
        _long_process_timer.start();
        return;
    }

    // long process work is done, do whatever comes after
}