Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def init():
uiautomator2.plugin_register("xpath", XPath)
"-P", "{0}x{1}@{0}x{1}/{2}".format(w, h, r),
"-s", ">"+remote_image_path])
if d.sync.stat(remote_image_path).size == 0:
raise RuntimeError("screenshot using minicap error")
buf = io.BytesIO()
for data in d.sync.iter_content(remote_image_path):
buf.write(data)
return Image.open(buf)
if __name__ == "__main__":
d = AdbUI(adbutils.adb.device())
xpath = XPath(d)
# print(d.screenshot())
# print(d.dump_hierarchy()[:20])
xpath("App").click()
xpath("Alarm").click()
# init()
def xpath(self) -> xpath.XPath:
return xpath.XPath(self)