From 3bec72b54bc46e0f568527b621d5094acd1a7821 Mon Sep 17 00:00:00 2001 From: Diego Torres Milano Date: Sun, 3 Sep 2023 20:28:05 -0700 Subject: [PATCH] Add culebra examples --- examples/helper/culebra/README.md | 1 + .../helper/culebra/culebra-take-snapshot.py | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 examples/helper/culebra/README.md create mode 100755 examples/helper/culebra/culebra-take-snapshot.py diff --git a/examples/helper/culebra/README.md b/examples/helper/culebra/README.md new file mode 100644 index 00000000..d0041ce8 --- /dev/null +++ b/examples/helper/culebra/README.md @@ -0,0 +1 @@ +This directory contains example of "untouched" culebra generated files. \ No newline at end of file diff --git a/examples/helper/culebra/culebra-take-snapshot.py b/examples/helper/culebra/culebra-take-snapshot.py new file mode 100755 index 00000000..bf6f4659 --- /dev/null +++ b/examples/helper/culebra/culebra-take-snapshot.py @@ -0,0 +1,39 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Copyright (C) 2013-2022 Diego Torres Milano +Created on 2023-09-03 by Culebra v22.5.1 + __ __ __ __ + / \ / \ / \ / \ +____________________/ __\/ __\/ __\/ __\_____________________________ +___________________/ /__/ /__/ /__/ /________________________________ + | / \ / \ / \ / \ \___ + |/ \_/ \_/ \_/ \ o \ + \_____/--< +@author: Diego Torres Milano +@author: Jennifer E. Swofford (ascii art snake) +""" + + +import os +import re +import sys +import time + +from com.dtmilano.android.viewclient import ViewClient, KEY_EVENT + + +TAG = 'CULEBRA' +_s = 5 +_v = '--verbose' in sys.argv +pid = os.getpid() + + +kwargs1 = {'verbose': False, 'ignoresecuredevice': False, 'ignoreversioncheck': False} +device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) + +kwargs2 = {'forceviewserveruse': False, 'startviewserver': True, 'autodump': False, 'ignoreuiautomatorkilled': True, 'compresseddump': True, 'useuiautomatorhelper': True, 'debug': {}} +vc = ViewClient(device, serialno, **kwargs2) + +helper = vc.uiAutomatorHelper +helper.ui_device.take_screenshot(filename=f'/Users/diego/Work/PycharmProjects/AndroidViewClient/tmp/ZY22DRTMS7-{pid}-0001-no_name-{helper.timestamp()}.png')