iOS - Hybrid / Able to find an element but not to click it

I’m able to find an element in hybrid but when clicking it nothing happens. This used to work in previous version of Appium.

This is the drivers log:
info: --> POST /wd/hub/session/aecc57c1-0730-439e-abcf-467e07ee2466/element/5007/click {“id”:“5007”}

info: [debug] [REMOTE] Executing ‘click’ atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger

info: [debug] [REMOTE] Receiving data from remote debugger

info: [debug] [REMOTE] Receiving data from remote debugger
info: [debug] [REMOTE] got applicationSentData response
info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“aecc57c1-0730-439e-abcf-467e07ee2466”}
info: <-- POST /wd/hub/session/aecc57c1-0730-439e-abcf-467e07ee2466/element/5007/click 200 17.521 ms - 76 {“status”:0,“value”:null,“sessionId”:“aecc57c1-0730-439e-abcf-467e07ee2466”}

Another interesting is that appium inspector doesn’t work in this scenario, it shows an empty list.

I’m using Appium 1.3.5

Thanks,
JM

Try to switch to native context, and see if page source contains any elements.

I tried switching to every context and the list remains empty.

A lot of things could be happening. I wrote a tap_by_location() method that will get the element, get its coordinates, and do a simple x/y tap. I only use it when necessary, but depending on how complex your app’s UI is, it may be necessary on a regular basis. Just my 2c. Good luck…

1 Like

I am doing the same thing in certain cases…

Thanks for the advices. I’ll try that and let you know.

I actually have the same issue with appium 1.3.5 and the latest java client. Switching back to native context and tapping on x,y seems also not to work. @jwallis how exactly does your setup look like (appium server version, appium client version, ios web proxy version)?

BTW if i switch to native context i am able to see the element in the dom.

Hm, it may be possible that the x/y from the native view is different from the x/y of the webview and is screwing things up. Can you tap other things on the screen by tapping x/y?

I’m not sure what “ios web proxy” is.

osx yosemite 10.10.1
appium server 1.3.4
appium-python-client 0.11
selenium 2.44.0
python 2.7.6

@jwallis what does selenium do in your setup? i followed: https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/hybrid.md#execution-against-a-real-ios-device

are you tetsing on ios 8.x?

The resolution stuff confused me already a bit. Because when i check the page source i can see that the window size is actually way smaller then the resolution of my device. Which shouldn’t be the case. Will check again if any click will arrive.

Oh, I think I failed to realize that you are testing on a real device. I don’t know how much different that makes things, and now I see the need for the webkit-proxy. I have never done this.

It seems like you should be able to get the coordinates of the element and the webview window using the native context, calculate the offset for the webview window, and do a plain driver.tap() or use TouchActions. Now I’m just throwing out ideas that you’ve already tried. Unfortunately I don’t have experience with what you’re trying to do : (

just figured out what went wrong. The resolution of my webview (which spans the whole app) has only half the resolution of the native app. So i just have to scale the coordinates from webview to the native view and voila the clicks are working fine. Seems to me very odd. Will try to figure out why things are so messed up.