Appium: Add autoAcceptAlerts to xcuitest driver

Created on 20 Sep 2016  ·  62Comments  ·  Source: appium/appium

Figure out how it worked in the ios driver, and see if it will work in the new system.

https://github.com/appium/appium/issues/6863

XCUITest iOS

Most helpful comment

@PrasannaGumpalli @Joskony @z00sts
I found a way to execute click without Alert if you are running tests on simulators:
capabilities.setCapability("nativeWebTap", "true");

This opened new tab without the alert.
However, the new problem is that it automatically switched to new window
driver.getWindowHandles(); returns only newly opened tab and don't see an old tab.
So if you need to switch back, it will not work.

Also, click with ("nativeWebTap", "true") not always worked for me too...

Warning: depending on viewport size/ratio this might not accurately tap an element

All 62 comments

@imurchie what's the status of this one, it says in progress?

In progress in the sense that I've been trying to find a way to do it. I haven't found one, though.

ok let's punt to 1.6.1 then.

@imurchie Since this is not working yet, is there a way to do the dismiss manually in the code using XCUITest?

Was doing $driver.alert_accept but that is not working either. Can you not dismiss alerts at all yet?

In my experience alert_accept works. Can you post (as a gist) the logs?

my suspicion is that in XCUITest there is no internal wait for the alert before trying to click it. The error I am getting is:

Selenium::WebDriver::Error::NoSuchAlertError:
       An attempt was made to operate on a modal dialog when one was not open.

I try waiting for the alert before clicking

def click_alert(name)
  $appium_driver.wait { find_element(:xpath, "//*[@name='#{name}']") }
  $appium_driver.alert_accept
end

but get the same error.:

@imurchie any ideas what might be wrong here?

I am concerned with what is going on on lines 55-56 and 212-213. That is very weird.

I'm looking into the rest.

In general there seems to be a lot of logs jumbled up in here. Not sure if that is the problem?

@imurchie Thanks for looking. Let me know if you need any more from me.

Not sure how that works. I tried it. It does click the alert but does not dismiss it. Very weird behavior.

I think at this point we should give it one more go to see if we can get this ui interruption monitor working, and otherwise just document that the autoAcceptAlerts capability is not functional. Maybe even adding a warning in the logs on session start.

@imurchie and @jlipps if that is the case, how would I simply manually dismiss an expected alert on a case by case basis. I had been doing this:

def click_alert_values(name)
  $appium_driver.wait { find_element(:xpath, "//*[@name='#{name}']").click }
end

where name is the text of the button to click. This was working until the upgrade to Xcode 8 and iOS 10. What is the right way to do it now?

Thanks in advance.

@danqa This approach should still work with XCUITest. Although it is supposed to be very slow, since xpath location is quite slow with XCTest.

I'm not sure about Ruby wrapper, but java-client uses the following API to handle alerts explicitly:

driver.switchTo().alert().accept() // to accept an alert 
driver.switchTo().alert().dismiss() // to dismiss an alert 
driver.switchTo().alert().getText() // to get alert text

They are fast and reliable, since native API calls are used

@mykola-mokhnach Thank you for the example. But isn't that for JS alerts not native iOS/Android system alerts? Does it work the same way?

@danqa we use the same API for native alerts

Got it:

$appium_driver.within_context('NATIVE_APP') do
    $appium_driver.alert_accept
  end

I've been trying to use appium + webdriver.io to test a Cordova app and @danqa 's comment finally pulled the right combination of methods together for me to accept a native dialog. Thanks!

Hello, has any one of you faced an issue when the system alert pop-up is already visible upon starting the test? The issue being that when web driver agent app is launching, appium does not connect to it, because it is under the system pop-up. This results in test failure. Can appium even dismiss the alert before it connects to web driver agent, or can it connect to it while it's not most upfront app?

@Faraen https://github.com/facebook/WebDriverAgent/issues/367
Shortly saying: 'No'. Unless this is a simulator, where you can potentially do it with Apple script or reset the simulator itself before to retry.

Thank you for quick answer :) I was afraid that that would be the case.

Hello,
Could someone please explain to me where I have to put the code "apple script"?
Thank you

@imurchie we've got this in the current sprint; i'm unclear about whether there's anything we can do now or whether we should just document this

@jlipps: Yes, not much we can do here, unless we want to add the overhead of making the calls on _every_ request.

No, I don't think that's worth it.

@imurchie maybe the acceptance criteria to close this should just be a note in caps.md and a warning printed out in the xcuitest driver if the cap is used? to the effect that the cap will have no effect and be ignored

Any issues about autoDismiss? Is autoDismiss=true works?

@jlipps Those seem like good ways to handle this problem.

@z00sts No. At this time neither work.

Hello,
is there still no way to auto accept the alerts in iOS using XCUITest and Appium?
Best,
Goncalo

Unfortunately, no.

since this function still doesn't work, what is the best work around to accept any alerts which pop up?

For Java client these will be methods based on _Alert_ interface:

getDriver().switchTo().alert().accept();
getDriver().switchTo().alert().dismiss();

@imurchie Is there a ruby client for auto accept alerts in appium 1.7.0 version for XCUI tests with xcode9?

No. Automatically accepting alerts is not possible in XCUITest with _any_ xcode. You need to do it yourself when an alert comes up.

@imurchie Alright! Thanks :)

For C# below methods work well to accept/dismiss alert message:
driver.SwitchTo().Alert().Accept();
driver.SwitchTo().Alert().Dismiss();

Manually accepting alerts doesn't work in my case.
I test web app in safari browser on iPhones and Click() on some of our buttons supposed to open new browser tab. And that's where my tests die.
Alert "This site is attempting to open a pop-up window" shows on click, there is no exception, test just stops an execution, and then fails in 5 or so minutes.

So Automatically accepting alerts is not possible in XCUITest, and I can't do it manually with driver.SwitchTo().Alert().Accept();

Any suggestions if there is any other workaround?

I'm able to run same tests on older phones (iPhone 5 and 6) with iOS 9. Appium 1.6.3
Tests start to fail when I select iOS 10 or higher.

@dimashyshkin can you define 'SystemAlertPage' and it's button(allow, don't allow) and whenever this page displayed then dismiss the page using click on defined(allow, don't allow) button.

@navnathkarche The problem is, that I can do nothing after click() command. Webdriver dies on it after a timeout.
And it doesn't look like that the alert is a browser alert.

can you provide appium log when webdriver dies.

2017-10-26 19:02:15:463 - [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@id,'FindFlights')]","647217b4-ecea-4989-880d-97f002baefec"]
2017-10-26 19:02:15:463 - [debug] [XCUITest] Executing command 'findElement'
2017-10-26 19:02:15:464 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
2017-10-26 19:02:15:464 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2017-10-26 19:02:15:464 - [debug] [RemoteDebugger] Executing 'find_element' atom in default context
2017-10-26 19:02:15:465 - [debug] [RemoteDebugger] Sending javascript command (function(){return function(){var k=this;functi...
2017-10-26 19:02:15:465 - [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
2017-10-26 19:02:15:471 - [debug] [RemoteDebugger] Received applicationSentData response
2017-10-26 19:02:15:471 - [debug] [RemoteDebugger] Found data handler for response
2017-10-26 19:02:15:472 - [debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":{"ELEMENT":":wdc:1509044499...'
2017-10-26 19:02:15:472 - [debug] [RemoteDebugger] Original command: sendJSCommand
2017-10-26 19:02:15:472 - [debug] [RemoteDebugger] Received result for atom 'find_element' execution: {"ELEMENT":":wdc:1509044499587"}
2017-10-26 19:02:15:472 - [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"5052"}
2017-10-26 19:02:15:473 - [HTTP] <-- POST /wd/hub/session/647217b4-ecea-4989-880d-97f002baefec/element 200 10 ms - 90 
2017-10-26 19:02:15:596 - [HTTP] --> POST /wd/hub/session/647217b4-ecea-4989-880d-97f002baefec/element/5052/click {"id":"5052"}
2017-10-26 19:02:15:596 - [debug] [MJSONWP] Calling AppiumDriver.click() with args: ["5052","647217b4-ecea-4989-880d-97f002baefec"]
2017-10-26 19:02:15:596 - [debug] [XCUITest] Executing command 'click'
2017-10-26 19:02:15:597 - [debug] [RemoteDebugger] Executing 'click' atom in default context
2017-10-26 19:02:15:597 - [debug] [RemoteDebugger] Sending javascript command (function(){return function(){var h,aa=this;fun...
2017-10-26 19:02:15:598 - [debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
2017-10-26 19:02:22:897 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:22 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4656]): Service exited with abnormal code: 1
2017-10-26 19:02:22:898 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:22 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:02:32:974 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:32 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4657]): Service exited with abnormal code: 1
2017-10-26 19:02:32:974 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:32 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:02:43:076 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:43 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4658]): Service exited with abnormal code: 1
2017-10-26 19:02:43:076 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:43 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:02:53:133 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:53 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4659]): Service exited with abnormal code: 1
2017-10-26 19:02:53:133 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:53 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:03:03:188 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:03 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4660]): Service exited with abnormal code: 1
2017-10-26 19:03:03:188 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:03 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:03:13:273 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:13 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4663]): Service exited with abnormal code: 1
2017-10-26 19:03:13:273 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:13 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:03:23:327 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:23 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4664]): Service exited with abnormal code: 1
2017-10-26 19:03:23:327 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:23 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:03:33:383 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:33 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4668]): Service exited with abnormal code: 1
2017-10-26 19:03:33:384 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:33 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:03:43:439 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:43 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4669]): Service exited with abnormal code: 1
2017-10-26 19:03:43:440 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:43 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:03:53:496 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:53 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4670]): Service exited with abnormal code: 1
2017-10-26 19:03:53:496 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:03:53 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:04:03:548 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:03 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4671]): Service exited with abnormal code: 1
2017-10-26 19:04:03:548 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:03 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:04:13:648 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:13 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4672]): Service exited with abnormal code: 1
2017-10-26 19:04:13:649 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:13 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:04:23:704 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:23 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4673]): Service exited with abnormal code: 1
2017-10-26 19:04:23:705 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:23 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:04:33:776 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:33 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4676]): Service exited with abnormal code: 1
2017-10-26 19:04:33:776 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:33 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:04:43:841 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:43 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4677]): Service exited with abnormal code: 1
2017-10-26 19:04:43:841 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:43 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:04:53:896 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:53 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4678]): Service exited with abnormal code: 1
2017-10-26 19:04:53:897 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:04:53 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:05:03:957 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:03 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4679]): Service exited with abnormal code: 1
2017-10-26 19:05:03:957 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:03 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:05:14:043 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:14 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4680]): Service exited with abnormal code: 1
2017-10-26 19:05:14:043 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:14 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:05:24:100 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:24 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4681]): Service exited with abnormal code: 1
2017-10-26 19:05:24:100 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:24 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:05:34:156 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:34 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4682]): Service exited with abnormal code: 1
2017-10-26 19:05:34:156 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:34 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:05:44:219 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:44 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4685]): Service exited with abnormal code: 1
2017-10-26 19:05:44:220 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:44 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:05:54:291 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:54 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4686]): Service exited with abnormal code: 1
2017-10-26 19:05:54:291 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:05:54 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:06:04:349 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:04 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4687]): Service exited with abnormal code: 1
2017-10-26 19:06:04:349 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:04 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:06:14:430 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:14 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4688]): Service exited with abnormal code: 1
2017-10-26 19:06:14:430 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:14 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:06:24:487 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:24 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4689]): Service exited with abnormal code: 1
2017-10-26 19:06:24:487 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:24 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:06:34:567 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:34 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4691]): Service exited with abnormal code: 1
2017-10-26 19:06:34:567 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:34 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:06:44:644 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:44 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4694]): Service exited with abnormal code: 1
2017-10-26 19:06:44:645 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:44 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:06:54:705 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:54 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4695]): Service exited with abnormal code: 1
2017-10-26 19:06:54:705 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:06:54 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:07:04:763 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:07:04 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4696]): Service exited with abnormal code: 1
2017-10-26 19:07:04:763 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:07:04 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:07:14:846 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:07:14 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4697]): Service exited with abnormal code: 1
2017-10-26 19:07:14:847 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:07:14 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
2017-10-26 19:07:15:620 - [HTTP] <-- POST /wd/hub/session/647217b4-ecea-4989-880d-97f002baefec/element/5052/click - - ms - - 
2017-10-26 19:07:25:006 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:07:25 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4700]): Service exited with abnormal code: 1
2017-10-26 19:07:25:007 - [iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:07:25 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

@dimashyshkin Try adding the safariAllowPopups capability, set to true.

@imurchie It is set.
2017-10-26 18:58:32:037 - [HTTP] --> POST /wd/hub/session {"requiredCapabilities":{},"capabilities":{"alwaysMatch":{"browserName":"Safari","platformName":"iOS"},"desiredCapabilities":{"deviceName":"iPhone 8 Simulator","name":"Debug | EQB-stgHome-iPhone8 | roundtripPositiveTest | iPhone 8 Simulator 11.0","platform":"MAC","browserName":"Safari","version":"","deviceOrientation":"portrait","platformVersion":"11.0","safariAllowPopups":"true","platformName":"iOS","appiumVersion":"1.7.1"},"requiredCapabilities":{},"firstMatch":[]},"desiredCapabilities":{"platformVersion":"11.0","deviceName":"iPhone 8","safariAllowPopups":"true","platformName":"iOS","webdriver.remote.quietExceptions":true}}
This helps on iOS 9 and older, but not on 10 and 11.
Here is same test on iPhone 6s Plus Simulator iOS 9.1
Exactly same code. There is same Alert "This site is attempting to open a pop-up window"
But the test is still opening all the new tabs and test is working.

@dimashyshkin can you run app manually and check after accepting alert app does not fail.
it's seems like iOS bug:
[iOSLog] [IOS_SYSLOG_ROW] Oct 26 12:02:22 itako43154 com.apple.CoreSimulator.SimDevice.4B8CE5D7-E9A2-4BBE-9734-FD5AE748C988[4217] (com.apple.videosubscriptionsd[4656]): Service exited with abnormal code: 1
@imurchie please can you look into this (is this iOS bug?)

@navnathkarche I don't see this alert, when trying manually in Safari on iPhone 7 iOS 10.3
It opens new tabs just fine without an alert.

What is the code that is opening the window? I'm trying to reproduce but can't get the popup to come up, even with the popup blocker on.

Here is a small test to reproduce the issue on iOS 10 and 11

    @Test(priority = 1)
    public void debugTestNo() {
        driver.get("https://stg.farecompare.com/flights/London-LON/New_York-NYC/market.html");
        driver.findElement(By.xpath("//*[contains(@id,'FindFlights')]")).click();

        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        Set<String> tabs = driver.getWindowHandles();
        System.out.println(tabs);
    }

And 3 executed tests on SauceLabs on different devices and OS combinations:

I will look into this further, @dimashyshkin

For now, remove the safariAllowPopups capability altogether. Seems to work.

@imurchie Are you using a simulator or real iOS device?
I don't think it going to work on the simulator.
Above test now fails on all 3 devices on driver.getWindowHandles(); with next:
An unknown server-side error occurred while processing the command. Original error: Could not connect to a valid app after 20 tries.
Link to one test

It says here that safariAllowPopups is Sim-only, I don't have real iOS device to test, but there is a problem on getWindowHandles on simulators without safariAllowPopups set to true, and I ran into this problem long time ago while was creating these tests.
safariAllowPopups was the only way to be able to work with other tabs in the safari browser.

Hi, Please can anyone help me how I can handle the autoAlerts using appium 1.7.1 and webdriver.io. I used 'autoAcceptAlerts: true' but no luck. I'm automating a test suite for IOS native app but unfortunately unable to run through sauce-labs due to 'autoAlert' handling. Please can anyone help me in resolving this issue.

Thanks,
Prasanna

I'm also having issues regarding alerts.
I made a question on stackoverflow for it.

Hi
AutoAcceptAlerts in XCUITest is not valid capability.
But you can crate method to validate alert on ViewController. Alert has “XCUIElenetTypeAlert” predicate, so you can easily validate presence of this element on any ViewController.
In case it exists switch to alert and accept or discard it.

fun alertAccept() = this.wd().switchTo().alert().accept()

fun alertDismiss() = (this.wd().switchTo().alert() as Alert).dismiss()

Yaroslav

On Nov 13, 2017, at 2:03 AM, Prasanna notifications@github.com wrote:

Hi, Please can anyone help me how I can handle the autoAlerts using appium 1.7.1 and webdriver.io. I used 'autoAcceptAlerts: true' but no luck. I'm automating a test suite for IOS native app but unfortunately unable to run through sauce-labs due to 'autoAlert' handling. Please can anyone help me in resolving this issue.

Thanks,
Prasanna


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/appium/appium/issues/6864#issuecomment-343779914, or mute the thread https://github.com/notifications/unsubscribe-auth/AP6vF47ppWQGy_r8WXYf-WXt3Sg0DfU_ks5s14dugaJpZM4KBm0l.

@arafatmeister Is this workaround available with appium-python-client?

@PrasannaGumpalli @Joskony @z00sts
I found a way to execute click without Alert if you are running tests on simulators:
capabilities.setCapability("nativeWebTap", "true");

This opened new tab without the alert.
However, the new problem is that it automatically switched to new window
driver.getWindowHandles(); returns only newly opened tab and don't see an old tab.
So if you need to switch back, it will not work.

Also, click with ("nativeWebTap", "true") not always worked for me too...

Warning: depending on viewport size/ratio this might not accurately tap an element

Any news on a workaround for the Javascript client?

Likewise, if anyone has any ideas for a workaround for the Javascript client I'd love to know!

**I am currently facing the similar issue(unable to perform click action) - Running my iOS tests on Sauce labs Real Device cloud.

Error below -**

13:57:47 VERBOSE: [debug] [XCUITest] Executing command 'proxyReqRes'
13:57:47 VERBOSE: [debug] [WD Proxy] Matched '/wd/hub/session/c21ec4d3-ea15-4546-b344-4e4dfb903a41/element/23000000-0000-0000-6501-000000000000/selected' to command name 'elementSelected'
13:57:47 VERBOSE: [debug] [WD Proxy] Proxying [GET /wd/hub/session/c21ec4d3-ea15-4546-b344-4e4dfb903a41/element/23000000-0000-0000-6501-000000000000/selected] to [GET http://10.101.40.29:5705/session/F1971038-2462-455A-AE78-E3CD1243C6A3/element/23000000-0000-0000-6501-000000000000/selected] with body: {}
13:57:47 VERBOSE: [debug] [WD Proxy] Got response with status 200: "{n "value" : "Unhandled endpoint: /session/F1971038-2462-455A-AE78-E3CD1243C6A3/element/23000000-0000-0000-6501-000000000000/selected -- http://10.101.40.29:5705/ with parameters {n wildcards = (n "session/F1971038-2462-455A-AE78-E3CD1243C6A3/element/23000000-0000-0000-6501-000000000000/selected"n );n}",n "sessionId" : "F1971038-2462-455A-AE78-E3CD1243C6A3",n "status" : 1n}"
13:57:47 VERBOSE: [debug] [MJSONWP (c21ec4d3)] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: The request to /wd/hub/session/c21ec4d3-ea15-4546-b344-4e4dfb903a41/element/23000000-0000-0000-6501-000000000000/selected has failed
13:57:47 VERBOSE: [debug] [MJSONWP (c21ec4d3)] at JWProxy.proxy (/Users/ios/appium/appium/1.12.0/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:180:13)
13:57:47 VERBOSE: [debug] [MJSONWP (c21ec4d3)] at
13:57:47 VERBOSE: [debug] [MJSONWP] Matched JSONWP error code 1 to UnknownError

My Capabilities - Appium v1.12.0 creating new XCUITestDriver (v2.110.0) session
13:57:26 VERBOSE: [Appium] Capabilities:
13:57:26 VERBOSE: [Appium] webDriverAgentUrl: http://10.101.40.229:5705
13:57:26 VERBOSE: [Appium] testobject_platform_name: iOS
13:57:26 VERBOSE: [Appium] orientation: PORTRAIT
13:57:26 VERBOSE: [Appium] realDevice: true
13:57:26 VERBOSE: [Appium] noReset: true
13:57:26 VERBOSE: [Appium] commandTimeouts: 60000
13:57:26 VERBOSE: [Appium] appiumVersion: 1.12.0
13:57:26 VERBOSE: [Appium] testobject_device: iPhone XR
13:57:26 VERBOSE: [Appium] bundleId: com.aaa.iphone.discounts.enterprise
13:57:26 VERBOSE: [Appium] deviceName: 00008020-001571280E62002E
13:57:26 VERBOSE: [Appium] testobject_appium_version: 1.12.0
13:57:26 VERBOSE: [Appium] newCommandTimeout: 60
13:57:26 VERBOSE: [Appium] automationName: XCUITest
13:57:26 VERBOSE: [Appium] testobject_api_key: api key
13:57:26 VERBOSE: [Appium] platformName: iOS
13:57:26 VERBOSE: [Appium] udid: 00008022E
13:57:26 VERBOSE: [Appium] autoAcceptAlerts: true

5413:57:26 V [debug] [WD Proxy] Got response with status 200: "{n "value" : {n "state" : "success",n "os" : {n "name" : "iOS",n "version" : "12.1.4",n "sdkVersion" : "12.0"n },n "ios" : {n "simulatorVersion" : "12.1.4",n "ip" : "10.101.219.95"n },n "build" : {n "time" : "Mar 20 2019 11:29:14",n "productBundleIdentifier" : "com.facebook.WebDriverAgentRunner"n }n },n "sessionId" : "9AED5A0B-261C-4469-B311-2DADD489534C",n "status" : 0n}"

Any help or suggestions regarding the issue?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings