コード例 #1
0
#! /usr/bin/env python
'''
Copyright (C) 2012  Diego Torres Milano
Created on Feb 3, 2012
This example starts the TemperatureConverter activity then type '123' into the 'Celsius' field.
Then a ViewClient is created to obtain the view dump and the current values of the views with
id/celsius and id/fahrenheit are obtained and the conversion printed to stdout.
Finally, the fields are obtained by using their tags and again, conversion printed to stdout.
If --localViewServer is passed in the command line then LocalViewServer provided by
TemperatureConverter is used. This is very useful when the device is secure and ViewServer
cannot be started.
@author: diego
'''
import re
import sys
import os
import time
# PyDev sets PYTHONPATH, use it
try:
    for p in os.environ['PYTHONPATH'].split(':'):
        if not p in sys.path:
            sys.path.append(p)
except:
    pass
try:
    sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'],
                                 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
コード例 #2
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2018  Diego Torres Milano
Created on 2018-03-29 by Culebra v15.0.1
                      __    __    __    __
                     /  \  /  \  /  \  /  \
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''
import sys
from androidviewclient3.viewclient import ViewClient
TAG = 'CULEBRA'
_s = 5
_v = '--verbose' in sys.argv
kwargs1 = {
    'ignoreversioncheck': False,
    'verbose': False,
    'ignoresecuredevice': False
}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {
    'forceviewserveruse': False,
    'useuiautomatorhelper': False,
    'ignoreuiautomatorkilled': True,
コード例 #3
0
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''

import re
import sys
import os

from androidviewclient3.viewclient import ViewClient

if len(sys.argv) < 2:
    sys.exit("usage: %s /path/to/filename.png [serialno]" % sys.argv[0])

filename = sys.argv.pop(1)
kwargs1 = {'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {
    'startviewserver': True,
    'forceviewserveruse': False,
    'autodump': False,
    'ignoreuiautomatorkilled': True
}
vc = ViewClient(device, serialno, **kwargs2)
vc.dump(window='-1')

vc.findViewWithContentDescriptionOrRaise('''Home screen 3''').writeImageToFile(
    filename, 'PNG')
コード例 #4
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013-2018  Diego Torres Milano
Created on 2018-03-29 by Culebra v15.1.0
                      __    __    __    __
                     /  \  /  \  /  \  /  \
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
"""
import re
import sys
import os
try:
    sys.path.insert(
        0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
    pass
from androidviewclient3.viewclient import ViewClient
TAG = 'CULEBRA'
_s = 5
_v = '--verbose' in sys.argv
kwargs1 = {
    'ignoreversioncheck': False,
    'verbose': False,