I have been trying to automate hybrid app using Ruby bindings
UI Flow is like this
Screen 1 -> Native View Containing Login buttons(Google)
Screen 2 -> Native Elements + UIWebView that contains buttons(Allow, Deny)
Screen 3 -> Native View
Here is the skeleton code
a) wait{find_element(:xpath,"//UIAButton[@name='Google'").click} b) wait.until{find_element(:xpath, "//UIAButton[@name='Allow'").displayed?} c) wait.until{find_element(:xpath, "//UIAButton[@name='Allow'").click}
I noticed ‘b’ always fails although I can see the button on the device.
With arc, following things happen
- pry>find_element(:xpath, “//UIAButton[@name=‘Allow’”).displayed?
- pry> false
- pry>find_element(:xpath, “//UIAButton[@name=‘Allow’”).click ## Failed
- pry> nil
- pry>find_element(:xpath, “//UIAButton[@name=‘Allow’”)
- pry># Selenium::WebDriver::Element:0x…fcb24f281c63578c6 id=“17”
- pry>find_element(:xpath, “//UIAButton[@name=‘Allow’”).click ## Passed
- pry>nil
I would like to understand what is happening between steps 3 to 8. (Is Appium changing contexts transparently etc…) –
- where initially step 3 failed even though button was visible
- Then after executing step 5, I am able to click button as done in step 7
Also would like to get suggestions on improving ruby code to incorporate the changes
Regards