Pressing a button on real device via python appium

I am requested to write a script in python to press on a button on real android device which is connected via usb.
i downloaded appium python client , appium server , and SDK and set up usb debugging .
Now i call this function.
def test_find_elements(self):
_ _
_ from appium.webdriver.common.touch_action import TouchAction_
_ action = TouchAction(self.driver)_
_ action.tap(x=3, y=4, count=5).release().perform()_
_ driver.sendKeyEvent(AndroidKeyCode.KEYCODE_MENU)_

So it gives error message as
Encountered internal error running command: Error: The desired capabilities must include either an app, appPackage or browserName

I don’t know what is wrong, i am new in appium,python ! , if you have better idea just tell me.
as i said what is required is to press button,make call , swipe on a real android device via python script.


Seems like you’ve gotten most of the way there. Here’s a tutorial on writing Appium tests in Python. Seems like you should skip to step 3, “Write the test”. Pay special attention to the setUp method, where the capabilities are specified:

1 Like