xiaocong / uiautomator

Python wrapper of Android uiautomator test tool.
MIT License
2.03k stars 642 forks source link

How to Perform select action on uiobject? #99

Open skyven223 opened 9 years ago

skyven223 commented 9 years ago

dear xiaocong,

with uiautomator i get uiobject successfully in android L (TV) however fail when perform click action.

E/AndroidRuntime( 2830): java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.view.View.getBackground()' on a null object reference

I found that most of the focused uiobject have the same node property value as below: clickable=False,selected=True

how to perform select action on selected uiobject, or any other better solution? Thanks in advance.

xiaocong commented 9 years ago

Hi @skyven223 ,

I'm sorry that I don't have Android L device on my hand. Firstly, I need you help is, does it occurs on Android L but not on Android 4.4? Secondly, I need more logcat, especially when the failed action performed.

The official Android web site has detailed documentation regarding the UiSelector. Generally I uses text, description, className, resourceId to identify the UiObject I want to perform on. As for select action, you'd better check android documentation about method android.view.View.setSelected. Hope it can help you out.