How to do right click on app using appium with Python

Is it possible to do right click on app icon in android.?

Note : I am automating the keyboard based android laptop.

how you make right click manually on device?

using mousepad same like we do in windows laptop.

Below are the key-event

adb shell getevent -l
add device 1: /dev/input/event3
name: “hall-switch”
add device 2: /dev/input/event0
name: “ACCDET”
add device 3: /dev/input/event6
name: “SINO WEALTH USB KEYBOARD”
add device 4: /dev/input/event4
name: “USB2.0 camera: USB2.0 camera”
add device 5: /dev/input/event1
name: “mtk-kpd”
add device 6: /dev/input/event2
name: “hid-over-i2c 0911:5288 Touchpad”
add device 7: /dev/input/event5
name: “SINO WEALTH USB KEYBOARD”
/dev/input/event2: EV_ABS ABS_MT_TRACKING_ID 0000009f
/dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000544
/dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000002f6
/dev/input/event2: EV_KEY BTN_TOUCH DOWN
/dev/input/event2: EV_KEY BTN_TOOL_FINGER DOWN
/dev/input/event2: EV_ABS ABS_X 00000544
/dev/input/event2: EV_ABS ABS_Y 000002f6
/dev/input/event2: EV_SYN SYN_REPORT 00000000
/dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000002f7
/dev/input/event2: EV_ABS ABS_Y 000002f7
/dev/input/event2: EV_SYN SYN_REPORT 00000000
/dev/input/event2: EV_KEY BTN_RIGHT DOWN
/dev/input/event2: EV_SYN SYN_REPORT 00000000
/dev/input/event2: EV_KEY BTN_RIGHT UP
/dev/input/event2: EV_SYN SYN_REPORT 00000000
/dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000002f9
/dev/input/event2: EV_ABS ABS_Y 000002f9
/dev/input/event2: EV_SYN SYN_REPORT 00000000
/dev/input/event2: EV_ABS ABS_MT_TRACKING_ID ffffffff
/dev/input/event2: EV_KEY BTN_TOUCH UP
/dev/input/event2: EV_KEY BTN_TOOL_FINGER UP
/dev/input/event2: EV_SYN SYN_REPORT 00000000

adb shell getevent -i

add device 1: /dev/input/event3
bus: 0000
vendor 0000
product 0000
version 0000
name: “hall-switch”
location: “”
id: “”
version: 1.0.1
events:
SW (0005): 0000
input props:

add device 2: /dev/input/event0
bus: 0019
vendor 0000
product 0000
version 0000
name: “ACCDET”
location: “”
id: “”
version: 1.0.1
events:
KEY (0001): 0072 0073 00a4 0246
SW (0005): 0002 0004 0006 0007
input props:

add device 3: /dev/input/event6
bus: 0003
vendor 6080
product 8060
version 0111
name: “SINO WEALTH USB KEYBOARD”
location: “usb-usb3_xhci-1.4/input1”
id: “”
version: 1.0.1
events:
KEY (0001): 0071 0072 0073 0074 008b 008e 008f 0090
0096 0098 009b 009e 009f 00a3 00a4 00a5
00a6 00ac 00ad 00d4 00d9 00e0 00e1 00f0
01a7 01a9
MSC (0004): 0004
input props:

add device 4: /dev/input/event4
bus: 0003
vendor 0bda
product 5830
version 0517
name: “USB2.0 camera: USB2.0 camera”
location: “usb-usb3_xhci-1.3/button”
id: “”
version: 1.0.1
events:
KEY (0001): 00d4
input props:

add device 5: /dev/input/event1
bus: 0019
vendor 2454
product 6500
version 0010
name: “mtk-kpd”
location: “”
id: “”
version: 1.0.1
events:
KEY (0001): 0072 0073 0074
input props:

add device 6: /dev/input/event2
bus: 0018
vendor 0911
product 5288
version 0100
name: “hid-over-i2c 0911:5288 Touchpad”
location: “0-002c”
id: “”
version: 1.0.1
events:
KEY (0001): 0110 0111 0145 0148 014a 014d 014e 014f
ABS (0003): 0000 : value 439, min 0, max 1419, fuzz 0, flat 0, resolution 14
0001 : value 206, min 0, max 805, fuzz 0, flat 0, resolution 14
002f : value 0, min 0, max 4, fuzz 0, flat 0, resolution 0
0035 : value 0, min 0, max 1419, fuzz 0, flat 0, resolution 14
0036 : value 0, min 0, max 805, fuzz 0, flat 0, resolution 14
0039 : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
input props:
INPUT_PROP_POINTER
INPUT_PROP_BUTTONPAD
add device 7: /dev/input/event5
bus: 0003
vendor 6080
product 8060
version 0111
name: “SINO WEALTH USB KEYBOARD”
location: “usb-usb3_xhci-1.4/input0”
id: “”
version: 1.0.1
events:
KEY (0001): 0001 0002 0003 0004 0005 0006 0007 0008
0009 000a 000b 000c 000d 000e 000f 0010
0011 0012 0013 0014 0015 0016 0017 0018
0019 001a 001b 001c 001d 001e 001f 0020
0021 0022 0023 0024 0025 0026 0027 0028
0029 002a 002b 002c 002d 002e 002f 0030
0031 0032 0033 0034 0035 0036 0037 0038
0039 003a 003b 003c 003d 003e 003f 0040
0041 0042 0043 0044 0045 0046 0047 0048
0049 004a 004b 004c 004d 004e 004f 0050
0051 0052 0053 0055 0056 0057 0058 0059
005a 005b 005c 005d 005e 005f 0060 0061
0062 0063 0064 0066 0067 0068 0069 006a
006b 006c 006d 006e 006f 0071 0072 0073
0074 0075 0077 0079 007a 007b 007c 007d
007e 007f 0080 0081 0082 0083 0084 0085
0086 0087 0088 0089 008a 008c 008e 0096
0098 009e 009f 00a1 00a3 00a4 00a5 00a6
00ad 00b0 00b1 00b2 00b3 00b4 00b7 00b8
00b9 00ba 00bb 00bc 00bd 00be 00bf 00c0
00c1 00c2 00f0
MSC (0004): 0004
LED (0011): 0000 0001 0002
input props:

How as normal user you do right click on same item with Android phone? No ay adb command. Just pure user behavior.

You have phone screen and finger. Nothing more.

Or your app has some special interruction with adb commands?

I tried multiple things like normal adb shell input keyevent commands but it is not working.
Actually If I tap on app icon then the app is getting open.
So I have to first hover over the app icon and then right click.

This is not a android phone. This is laptop which having android OS.

There is no hoover on phone. There is long, short, double tap and so on. One of this action should call menu you want.

Yes I tried long, short, double tap but not getting desired o/p. :frowning:
So what I was trying to provide key events usind adb shell. But In Keyevent there are multiple events are generating which is include touch + key .

We cant help you without answers. How with finger you can call needed menu?

There is a touchpad / mousepad in device and I am just pressing at bottom right corner for needed menu options.

Aga. So this is not a simple phone. This is device with custom control. You need to find out what action takes your control device while you press on right button. This action may be not same as we expecting. Check logcat logs while you press. Maybe this will help better.

There is possibility that adb command will not help. If you can try ask developers for help.

List of commands with adb to try

Sure @Aleksei, Thank you for your valuable time. Much appreciate.

Should be possible with W3C actions. Simply set the pointer type to mouse

Adding link
https://appium.io/docs/en/commands/interactions/actions/

Also check

1 Like