Closed johnklee closed 2 years ago
We already have take_screenshot
in AndroidDevice
right?
https://github.com/google/mobly/blob/master/mobly/controllers/android_device.py#L1034
Cool! Thanks for the reminder and it is of great help to us to learn that this useful method is already supported! I should check the source code first. Then this issue is no longer needed.
By the way, after checking the implementation, it seems we can only decide the prefix of the file name:
filename = self.generate_filename(prefix, extension_name='png')
Is there a reason why not let user to decide the full file name here? Otherwise, we may have to rename the output file from the return pic_path
which is not bothering but we expect to be supported from the API. Thanks in advance!
Ps. From our code, we already handled the generation of appending timestamp of the filename and will use it to associate with other files (e.g. bugreport, log).
"prefix" is the field that you can customize. The API handles addition of device identity and name de-dupe in filenames. It's probably better than trying to create yet another system to do the same thing with file names.
We recommend you use AndroidDevice#generate_filename
for all your file names related to Android devices.
Understood. Thanks for the explanation and feedback.
From our user cases, we have to take screenshot of Phone quite a lot. Below is the code snippet for doing so:
I think it might be a good idea to let controller AndroidDevice to support it natively. Therefore, create this issue as feature request. Thanks!