I am showing UIAlertController in iOS and same code executes for iPhone and iPad. So can anyone help with this. As I google but didn't find any thing to justify this. Below is the code I have used:-
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
let okAction = UIAlertAction(title: "Button.Ok".localizedValue(), style: .destructive, handler: { _ in
})
let cancelAction = UIAlertAction(title: "Button.Cancel".localizedValue(), style: .default, handler: { _ in
alert.dismiss(animated: true, completion: nil)
})
alert.accessibilityLabel = self.viewModel.deleteUserConfirmationAccessibilityId()
alert.addAction(okAction)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)
So the problem is this:- iPhone : "Remove all saved" text come under UIAView of the DOM Structure when doing automation testing for the UIAlertController in iPhone. iPad : "Remove all saved" text come under UIView of the DOM Structure when doing automation testing for the UIAlertController in iPad.
So why difference is coming in UIAlertController structure as iPhone iPad showing UIView and iPhone UIAView for the same code.
You have to add popoverpresentation controller for ipad. Please see below code