How can I use UiDevice and UiObject classes?

Hi

I’m new to Appium. How can I use UiDevice and UiObject classes for native app testing.

Can you help me with real time examples.

For iOS or Android? Could you please be more specific to help you.
Also, post where you are stuck?

Hi,

I want to use these for Android. I don’t have any specific scenario to tell but want to learn how there can be used in Appium/Android automation as I’m very new to Appium.

Please help.

@Bharath_Madishetti: Very high level statement.
Start from here to learn automating android using appium: http://appium.io/slate/en/tutorial/android.html?java#

Try few things on your own and come back here in case you are stuck somewhere. This community would be very glad to help you.

Hi, I have gone through it earlier and I felt it was at very high level, not much useful for novice.

Can you please answer to below thread if possible.

Hi Bharath,

Actually Appium had abstracted UIAutomator objects. So you can not directly access UIDevice/UIObjects directly But appium internally do this for you. So from point of beginner, you just need basic exposure of Selenium-webdriver and any of programming language to kick off mobile automation.

Thanks,
Priyank Shah

Priyank is right – avoid the uiautomater code unless absolutely needed.

You are looking for this call

driver.press_keycode(4)  # 4 is the keycode for back
driver.press_keycode(84) # 84 is the keycode for search

Answered in that thread.