Hello,
I am trying to automate tests for web application in Safari browser. I have a case where after clicking on some WebElement system iOS popup has been triggered. I am trying to click on this with several ways but wihout effect. Unfortunately design of how it is handled is very annoying because to handle this popup I need to use try catch block because exception is raised under the click method. But as I said I am able to handle this with try catch so this is what I am already tried.
First approach:
Driver.SwitchTo().Alert().Accept(); and Driver.SwitchTo().Alert().Dismiss();
In Appium I can see following output:
[debug] [W3C (54e1d035)] Calling AppiumDriver.getAlertText() with args: [â54e1d035-fbb1-4cc3-93a2-40e0399d97abâ]
[debug] [XCUITest] Executing command âgetAlertTextâ
[debug] [W3C (9a8f5d54)] Encountered internal error running command: Error: Did not get any response after 300s
As you see there is no response and my test is crashed without dismiss or accepting alerts.
Second approach
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add(âactionâ, âacceptâ);
dictionary.Add(âlabelâ, âAllowâ);
IJavaScriptExecutor js = (IJavaScriptExecutor)driverWrapper.Driver;
js.ExecuteScript(âmobile:alertâ, dictionary);
I am also gave a try following line instead of second line in the snippet:
dictionary.Add(âactionâ, âpostAcceptAlertâ);
In Appium I can see following output:
[HTTP] {âscriptâ:âmobile:alertâ,âargsâ:[{âactionâ:âpostAcceptAlertâ,âlabelâ:âAllowâ}]}
[debug] [W3C (f3df7c18)] Calling AppiumDriver.execute() with args: [âmobile:alertâ,[{âactionâ:âpostAcceptAlertâ,âlabelâ:âAllowâ}],âf3df7c18-3e4b-4574-8004-d29b9db6a2b7â]
[debug] [XCUITest] Executing command âexecuteâ
And it have timeout after 60 seconds.
Someone can help me? I am already waste 2 days for this annoying case.