When the app is launched the first time, due to the alerts not being dismissed the app would crash. Adding autoAcceptAlerts: true in the capabilities fixed it for us.
What I now see is that all alerts in the app get auto accepted. Like a delete confirmation or invalid text alert etc.
Is this expected behavior? If yes, is there a work around or a better way to dismiss initial pop ups so I can still continue accept/decline the app related alert and pop ups?
It is something new to me a parameter which we pass while desired capabilities while creating HTTP session, how we can override it in same HTTP session once session is created.
like first i told appium server to set autoAcceptAlerts = true and then after some time I set it autoAcceptAlerts =false in same session
I dont recommend my own suggestion. You should take the route @Mobile_Test_Test suggested and which I agreed on. Because that is the right route to take in the long run.
When the driver gets initialized I pass
autoAcceptAlerts: true and this works for me to accept system alerts. Once the app is successfully launched and the alerts are accepted, i try to use this before my test begins
$appiumDriver.update_settings({autoAcceptAlerts: false})
Is this the correct syntax? Or does anyone have a working example for this?
Appium logs:
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:0,“value”:{“ELEMENT”:“0”}}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“0”},“sessionId”:“e079a84b-a534-4434-8ca5-5269166f2b13”}
info: <-- POST /wd/hub/session/e079a84b-a534-4434-8ca5-5269166f2b13/element 200 6555.198 ms - 87 {“status”:0,“value”:{“ELEMENT”:“0”},“sessionId”:“e079a84b-a534-4434-8ca5-5269166f2b13”}
info: --> POST /wd/hub/session/e079a84b-a534-4434-8ca5-5269166f2b13/appium/settings {“settings”:{“autoAcceptAlerts”:false}}
info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“e079a84b-a534-4434-8ca5-5269166f2b13”}
info: <-- POST /wd/hub/session/e079a84b-a534-4434-8ca5-5269166f2b13/appium/settings 200 5.426 ms - 76 {“status”:0,“value”:null,“sessionId”:“e079a84b-a534-4434-8ca5-5269166f2b13”}
info: --> POST /wd/hub/session/e079a84b-a534-4434-8ca5-5269166f2b13/appium/settings {“settings”:{“autoAcceptAlerts”:false}}
info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“e079a84b-a534-4434-8ca5-5269166f2b13”}
info: <-- POST /wd/hub/session/e079a84b-a534-4434-8ca5-5269166f2b13/appium/settings 200 2.370 ms - 76 {“status”:0,“value”:null,“sessionId”:“e079a84b-a534-4434-8ca5-5269166f2b13”}
info: --> GET /wd/hub/session/e079a84b-a534-4434-8ca5-5269166f2b13/source {}
But after accepting the alert. I am unable to go back to the app after accepting the alert
Getting this error:
Exception in thread “main” org.openqa.selenium.NoAlertPresentException:
An attempt was made to operate on a modal dialog when one was not open.
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.35 seconds
So how could I go back to the app after accepting the alert?
How to do this? once after driver is set to launch the app same driver will be used in further cases right? where and how can i reinitialize it .Please help