IOS Alert issue with java client 6.0.0-BETA5 and appium 1.8


#1

On an iPhone running 11.3, the IOSAlert code is definitely having issues. This should be throwing an exception since there are no alerts present:

Alert alert = getDriver().switchTo().alert();

However instead an “Alert” is being returned, and the getText() on it returns:

Alert is: {stacktrace=NoSuchAlertError: [object Object]
    at errorFromMJSONWPStatusCode (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/appium-base-driver/lib/protocol/errors.js:769:12)
    at getResponseForW3CError (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/appium-base-driver/lib/protocol/errors.js:797:13)
    at asyncHandler$ (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:352:37)
    at tryCatch (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/bedouglas/build_tools/ios_phone/caf664481f8b97692f30fe08fb06f2c135218bc1/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at <anonymous>, error=no such alert, message={}}

Appium log shows this:

2018-05-14 19:07:39:605 - [HTTP] --> GET /wd/hub/session/8373b5a1-0aa5-4a0f-9589-fd31bcd1851e/alert_text
2018-05-14 19:07:39:605 - [HTTP] {}
2018-05-14 19:07:39:607 - [debug] [W3C] Calling AppiumDriver.getAlertText() with args: ["8373b5a1-0aa5-4a0f-9589-fd31bcd1851e"]
2018-05-14 19:07:39:608 - [debug] [XCUITest] Executing command 'getAlertText'
2018-05-14 19:07:39:612 - [debug] [JSONWP Proxy] Proxying [GET /alert/text] to [GET http://localhost:8661/session/01FC5970-FF43-4F4B-A975-81A38B8B25C3/alert/text] with no body
2018-05-14 19:07:39:753 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n\n  },\n  \"sessionId\" : \"01FC5970-FF43-4F4B-A975-81A38B8B25C3\",\n  \"status\" : 27\n}"
2018-05-14 19:07:39:758 - [debug] [MJSONWP] Matched JSONWP error code 27 to NoSuchAlertError
2018-05-14 19:07:39:772 - [HTTP] <-- GET /wd/hub/session/8373b5a1-0aa5-4a0f-9589-fd31bcd1851e/alert_text 404 166 ms - 1433
2018-05-14 19:07:39:773 - [HTTP] 
2018-05-14 19:07:39:779 - [HTTP] --> GET /wd/hub/session/8373b5a1-0aa5-4a0f-9589-fd31bcd1851e/alert_text
2018-05-14 19:07:39:780 - [HTTP] {}
2018-05-14 19:07:39:780 - [debug] [W3C] Calling AppiumDriver.getAlertText() with args: ["8373b5a1-0aa5-4a0f-9589-fd31bcd1851e"]
2018-05-14 19:07:39:781 - [debug] [XCUITest] Executing command 'getAlertText'
2018-05-14 19:07:39:783 - [debug] [JSONWP Proxy] Proxying [GET /alert/text] to [GET http://localhost:8661/session/01FC5970-FF43-4F4B-A975-81A38B8B25C3/alert/text] with no body
2018-05-14 19:07:39:922 - [debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n\n  },\n  \"sessionId\" : \"01FC5970-FF43-4F4B-A975-81A38B8B25C3\",\n  \"status\" : 27\n}"
2018-05-14 19:07:39:923 - [debug] [MJSONWP] Matched JSONWP error code 27 to NoSuchAlertError
2018-05-14 19:07:39:924 - [HTTP] <-- GET /wd/hub/session/8373b5a1-0aa5-4a0f-9589-fd31bcd1851e/alert_text 404 144 ms - 1433