testing-samples icon indicating copy to clipboard operation
testing-samples copied to clipboard

testing volume control button

Open BorisKenne opened this issue 6 years ago • 3 comments

Hello everyone, I really want to know how to click on the volume hardware button by using uiAutomator. thank you!

BorisKenne avatar May 17 '19 13:05 BorisKenne

Does either UIAutomation.injectInputEvent(KeyEvent.VOLUME_DOWN) or Instrumentation.sendKeySync((KeyEvent.VOLUME_DOWN) work for you?

brettchabot avatar May 17 '19 21:05 brettchabot

Hello Mr @brettchabot, Neither work for me! UiAutomation does'nt show me the "injectInputEvent".same think for Instrumentation with is sendKeySync. Thank you for your help! Do you have any other solution?

BorisKenne avatar May 20 '19 15:05 BorisKenne

Hi, I think this can be helpful: https://github.com/fireicewolf/EasyUIautomator/blob/master/app/src/main/java/com/dukeg/easyuiautomator/KeyEvent.java

BorisKenne avatar May 22 '19 15:05 BorisKenne