Appium 1.3.4, iOS 8.1 simulator - UIAButton could not be tapped

Click() works fine for me for most of the time (e.g. .elementByName(“Cancel”).click() ), just the click on Cancel button not works… that field doesn’t have accessibility id, but do have an unique name, I’ve tried both name and xpath for iOS 7.1 (5s), all work fine; just none of them working when try to run my tests on iOS 8.1 (5s) simulator.

I’ve uploaded a screenshot there…can anyone please help me to take a look? many thanks!
CloudApp

from the log, I saw the following error:

info: [debug] Pushing command to appium work queue: “au.tapById(‘4’)”
info: [debug] Sending command to instruments: au.tapById(‘4’)
info: [debug] [INST] 2015-01-27 18:09:12 +0000 Debug: responding with:
info: [debug] [INST] 2015-01-27 18:09:12 +0000 Debug: Running system command #16: /usr/local/Cellar/node/0.10.33/bin/node /Users/ywang24/workspace/test-ios-wt/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:[{“ELEMENT”:“4”}]}…
info: [debug] [INST] 2015-01-27 18:09:12 +0000 Debug: Got new command 16 from instruments: au.tapById(‘4’)
info: [debug] [INST] 2015-01-27 18:09:12 +0000 Debug: evaluating au.tapById(‘4’)
info: [debug] [INST] 2015-01-27 18:09:12 +0000 Debug: UIAButton.tap()
info: [debug] [INST] 2015-01-27 18:09:12 +0000 Debug: UIAButton could not be tapped

I’ve opened up the Appium inspector, and checked all the attributes of that Cancel button, it shows same between iOS 7.1 and iOS 8.1 simulator. I don’t understand why it works on iOS 7.1 simulator but not on 8.1. Is this an Appium bug?

When you use the locator in the Appium Inspector, does it find the button?

Thank you Brian, and yes, when I use the inspector, it could find that button. But after tab, nothing happen.

Hi,

Sometimes the elements are not visible and so click() does not work.

You can try to do a gesture tap on the element. Still sometimes it may result in error and in that case just press it:

def _press(element)
    Appium::TouchAction.new.press(element: element).perform
end

Thank you! I’ve even tried to add a javascript tab on that location, but still not works. -_-!

.execute(“mobile: tap”, { “tapCount”: 2, “touchCount”: 2, “duration”: 0.9, “x”: 238, “y”: 26 });

Its a simple button? It required double tap to be activated?

Hi,

I had the same problem. The elements on the page where visible but not clickable. After putting Thread.sleep() before clicking the element worked for me.

Hi, I finally found a workaround for my issue - I recorded a session using Instrument’s Automation tool… and found the (x, y) location for that button is way off… for my case here its (277, 35); but from UI, it should be something like (238, 26)… but after I use the new (x, y), it’s working…

Any idea why the real click location is way off? Thanks!