How to press two physical android keys in appium

I am trying to take a screenshot using physical buttons, volume up and power button pressed together, please help me implementing the same

is there any option to do it?

For android use

Thank you,
but unfortunately, I wasn’t able to take a screenshot with that method.
Is that possible to press the volume up and power buttons together, and not one after the other?

have you tried with

public void screenshot() {
      driver.pressKey(new KeyEvent()
1 Like

Hello, @Giuma. Thank you for your response.

I am currently using Python, and unfortunately, none of the code translations I have tried to your suggestion provided me, have given me the desired result.

You can try to send keys using W3C actions as described in

The article contains an example of simultaneous Shift+F depressing