I want to save a png image on the hard disk. The first time it takes 1.6 seconds while the second time onwards it takes more than 3 seconds why is that?
import appium.webdriver
from appium import webdriver
import time
import PIL
from PIL import Image
import datetime
"""
Desired Capabilities
"""
desired_cap = {
"deviceName": "ZY2244B53V",
"platformName": "Android",
"appPackage": "==",
"appActivity": "com.tictok.tictokgame.activities.HomeActivity",
"automationName": "UiAutomator1"
}
webdriver = webdriver.Remote("http://localhost:4723/wd/hub",desired_cap)
n=0
while n<2:
a=datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
print("time of start saving image" + str(a))
webdriver.save_screenshot("D:/Python/winzo_memory/a.png")
b=datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
print("time of end saving image" + str(b))
a=datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
print("time of start opening image" + str(a))
im = Image.open("a.png")
b=datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
print("time of end opening image" + str(b))
n=n+1
output:
time of start saving image2020-08-23 06:56:41.252
time of end saving image2020-08-23 06:56:42.837
time of start saving image2020-08-23 06:56:42.904
time of end saving image2020-08-23 06:56:45.952
I am trying to take a screenshot in appium driver. Is there a faster way to take a screenshot and let python read the pixels? Thanks in advance.
My operating system is windows 7. the image is 1080X1920. and the size of the image is aprx 1.5 mb. not sure about HDD or SSD.