예제 #1
0
def explore():
    print("learning")
    clas = classify.learn("../guis/", None)
    element_clas = elements.learn("../guis/", None)

    print("exploring")
    dev = device.Device()
    while True:
        hier = sense.grab_full(dev)
        if not hier['xml']:
            logger.error("fail to grab hierarchy")
            return

        print(hier['act'])
        guess_scr = clas.classify(hier['xml'], hier['act'], hier['scr'])
        print("classify: %s" % (guess_scr))

        items = analyze.parse_xml(hier['xml'])
        tree = analyze.analyze_items(items)

        imgdata = sense.load_image(hier['scr'])

        guess_descs = {}
        treeinfo = analyze.collect_treeinfo(tree)
        for itemid in tree:
            guess_element = element_clas.classify(guess_scr, tree, itemid,
                                                  imgdata, treeinfo)
            if guess_element != 'NONE':
                guess_descs[itemid] = guess_element

        util.print_tree(tree, guess_descs)

        input('enter')

        if False:
            itemid = random.choice(sorted(tree))
            if 'click' in tree[itemid] and tree[itemid]['click']:
                print("Clicking %s" % util.describe_node(tree[itemid]))
                widget.click(dev, tree[itemid])
예제 #2
0
#!/usr/bin/env python

import init
import widget
import interface

#apk_path = "/home/henryhu/betterbatterystats.apk"
#apk_path = "/home/henryhu/KeePassDroid-1.9.10.apk"
apk_path = "/home/henryhu/signed.apk"

init.init_testlib(apk_path)
interface.set_auto_wait(True)
widget.click("button_add_item")
interface.wait_for_idle()
widget.click("button1")
interface.wait_for_idle()
widget.enter("autocomplete_add_item", 'test')
widget.click("button_add_item")
interface.wait_for_idle()
init.finish()
예제 #3
0
#!/usr/bin/env python

import init
import widget
import interface

#apk_path = "/home/henryhu/betterbatterystats.apk"
#apk_path = "/home/henryhu/KeePassDroid-1.9.10.apk"
apk_path = "/home/henryhu/KeePass-1.9.6.apk"

init.init_testlib(apk_path)
interface.set_auto_wait(True)
widget.click("browse_button")
init.finish()