Ok, first thank you for posting the full log. I do see a lot of problems in there, and I’m going to try and cover them all, but first let me address the issue at hand: Why are your alerts not being accepted.
When I look at the first (truncated) log, I see this:
[XCUITest]\cf2 Executing command ‘getAlertText’
[debug] \cf3 [WD Proxy]\cf2 Matched ‘/alert/text’ to command name ‘getAlertText’
[debug] \cf3 [WD Proxy]\cf2 Proxying [GET /alert/text] to [GET http://127.0.0.1:8100/session/2A8493E7-71C7-459F-A1D4-B5B399F30F2A/alert/text] with no body
\cf3 [WD Proxy]\cf2 Got response with status 404: {“value”:{“error”:“no such alert”,“message”:“An attempt was made to operate on a modal dialog when one was not open”,“traceback”:“”},“sessionId”:“2A8493E7-71C7-459F-A1D4-B5B399F30F2A”}
[debug] \cf3 [W3C]\cf2 Matched W3C error code ‘no such alert’ to NoSuchAlertError\
What does the above mean? If read plainly it says that the test code attempted to get the /alert/text, but there was no alert present. Note that this error is NOT present in the second, more complete log.
Here are the reasons the error could not be handled:
- Timing issue. Code to handle alert is called before/after alert is present. In this case I would think it’s before.
- Pop up is not an alert. Not all pop ups are alerts. I would encourage you to take a look with Appium Inspector to see if element of type XCUIElementTypeAlert exists. If not, it’s not an alert and you will have to handle it with your code.
- Mistake in your code. This one is tough to judge as I can’t see your code. However, the log shows some problems so I will address those in the hope that you can improve it.
- Bug in Appium. While I think this is unlikely, if you really think so you should write a Short Self Contained Correct Example and share it. More on that concept here: http://www.sscce.org/
For the second, (more complete) log, the above issue is not present. In that log the failure is:
WebDriverAgent]\cf2 xcodebuild exited with code ‘65’ and signal ‘null’
This indicates a problem with signing the WebDriverAgent. This is outside the scope of handling alerts, so I encourage you to read and follow this tutorial:
https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md
Other advice:
- Your capabilities are inconsistent, at best. Why use MobileCapabilityType for only some capabilities but not others? Try to be consistent in your code if only to eliminate errors.
- You don’t include the capability, ‘automationName’. The log complains about this and states that in the future this will be required. Why not fix it now before it’s a problem?
Finally, I’m going to point you to 2 things:
- A couple of basic tutorials on automating with dot net: Mobile Automation with Appium in .NET - Setup and writing first test - Multiplatform App https://www.automatetheplanet.com/getting-started-appium-android-csharp/
- Another thread on iOS Alerts. We can all learn a lot from reading these: Unable to accept iOS permission alerts from appium automation code
I wish you good luck and I hope this helps.