Click on capture image button of camera

I am trying the below scenario, Any suggestions ?

  1. open a camera from browser.
  2. click on the File / Camera from popup
  3. Click on OK for allowing camera to access files.
  4. click on take Photo Image
  5. click on Tick Mark.

Any idea ?

MobileElement startRecording = (MobileElement) driver.findElementById(“com.earningvideo:id/record_button”);

startRecording.click();

Thread. sleep (10000);

System. out .println(“click on the button start recording”);

driver.rotate(org.openqa.selenium.ScreenOrientation. LANDSCAPE );

System. out .println("––*-- Now screen orientation Is : "+ driver.getOrientation());

Thread. sleep (5000);

MobileElement closeRecordingScreen = (MobileElement) driver.findElementById(“com.earningvideo:id/close_camera”);

closeRecordingScreen.click();

System. out .println(“closeRecordingScreen”);

Thread. sleep (5000);

For me the following codes worked on Android

27 # to open the camera
sleep 3 secs
27 # to make a shot
sleep 3 secs
66 # to click on OK button and return to the app

As for an android virtual device

27 # to open the camera
sleep 3 secs
27 # to make a shot
sleep 3 secs
# please don't ask why about the rest. I just ran a `for` loop to check all possilbe codes and the sequence below just worked fine. If you know anything better, please suggest
sleep 3 secs
55
sleep 3 secs
61
sleep 3 secs
62 # to return to the app
1 Like