Hi guys,
So im testing iOS app and i got situation when 2 alerts pop up one after another. And first one is hidden after the second one. Appium says that multiple choices is found and don
t give the ability to select
I`m using ruby bindings, is there a way to bypass this situation
[debug] [BaseDriver] Waiting up to 11000 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /elements] to [POST http://localhost:8100/session/FBD28E85-0A3F-4F7A-9673-C254F4B44FE9/elements ] with body: {“using”:“xpath”,“value”:"//*[@name=“Enable”]"}
[debug] [WebDriverAgent] Sim: Feb 27 19:38:01 administrators-Mac-mini XCTRunner[86514]: Enqueue Failure: UI Testing Failure - Multiple matches found:
[debug] [WebDriverAgent] Sim: →Application 0x600000577100: {{0.0, 0.0}, {320.0, 568.0}}, label: ‘Test’
[debug] [WebDriverAgent] Sim: ↳Window 0x6000005774c0: Main Window, {{0.0, 0.0}, {320.0, 568.0}}
[debug] [WebDriverAgent] Sim: ↳Other 0x6000005783c0: {{0.0, 0.0}, {320.0, 568.0}}
[debug] [WebDriverAgent] Sim: ↳Alert 0x600000578600: traits: 72057602627862528, {{25.0, 185.5}, {270.0, 197.5}}, label: ‘first’
[debug] [WebDriverAgent] Sim: →Application 0x600000577100: {{0.0, 0.0}, {320.0, 568.0}}, label: ‘Test’
[debug] [WebDriverAgent] Sim: ↳Window 0x6000005774c0: Main Window, {{0.0, 0.0}, {320.0, 568.0}}
[debug] [WebDriverAgent] Sim: ↳Other 0x600000579c80: {{0.0, 0.0}, {320.0, 568.0}}
[debug] [WebDriverAgent] Sim: ↳Alert 0x600000579ec0: traits: 72057602627862528, {{25.0, 139.0}, {270.0, 290.0}}, label: ‘Second’ /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 35 1
wreed
February 28, 2017, 2:39am
2
Iterate through them in a loop. You don’t give your code so I’m doing a bit of guesswork:
alerts = <however you are finding these>
alerts.each do |alert|
alert.accept
end
Hello Wreed, thank you for your insight and sorry for minimal info.
Your method can’t be aplied cos my code looks like
Element :my_button, xpath “//*[@name=“evaluate”]” #can be typos here
Page.driver.browser.switch_to.alert
And here appium gives error, i’ve tried to use find_custom to get those alerts to list, and got blank list. Is therer a way to access alert by it’s label maybe?
slipy12
February 28, 2017, 7:51am
4
You could also try to click by exact_text
texts_exact(“Accept”).last.click
Never faced this problem so we have to face the solution for the first time I think. Maybe is an scenario where appium gets stuck :S
wreed
February 28, 2017, 6:30pm
5
Hmm. Seems like switch_to.alert is having a problem with the two alerts. Looks like a bug to me. According to this documentation, you might be able to work around this with a helper method like, ‘accept_alert’. Take a look and see if that doesn’t help:
# Documentation
## API Doc of Ruby Client
- This library: http://www.rubydoc.info/github/appium/ruby_lib
- Core: http://www.rubydoc.info/github/appium/ruby_lib_core
- [Ruby selenium-webdriver](https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings)
### General
- [Appium](https://github.com/appium/appium/blob/master/README.md)
- [Supported platforms](https://github.com/appium/appium/blob/master/docs/en/about-appium/platform-support.md)
- [All methods supported by Appium](https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md)
- Fundamental Commands: http://appium.io/docs/en/commands/status/ etc
- [MiniTest Expectations](http://docs.seattlerb.org/minitest/Minitest/Expectations.html)
### Driver types in Ruby Client
```ruby
# Appium specific driver with helpers available extending Standard Appium Driver.
@appium_driver = Appium::Driver.new @options, false
# Standard Appium Driver extends Selenium WebDriver.
This file has been truncated. show original
slipy12, wreed Thank you very much for your responses, i will try those 2 sollutions and get back at you.
Currently to fasten up, testing, we solved it from the developers side by not showing second alert until first one is present.
1 Like