コード例 #1
0
ファイル: android44.py プロジェクト: fxlysm/PYAndroid_Test
    def test_launcher_widgets(self):
        print("Test Widgets")
        d.press.back()
        time.sleep(2)
        d.press.home()
        time.sleep(2)
        d.press.menu()
        if d(text="Widgets",className="android.widget.TextView", resourceId="com.android.launcher3:id/widget_button").exists:
            print("Found Widgets")
            d(text="Widgets",className="android.widget.TextView", resourceId="com.android.launcher3:id/widget_button").click()
            time.sleep(2)
            while not d(text="Email",className="android.widget.TextView", resourceId="com.android.launcher3:id/widget_name").exists:
                d.swipe(400, 500, 50, 500, steps=50);
            if d(className="android.widget.LinearLayout").child(text="Email",className="android.widget.TextView", resourceId="com.android.launcher3:id/widget_name").exists:
                print("swipe email widget to launcher")
                d.drag(360, 200, 480, 200, steps=100)
                time.sleep(2)
                if d(text="Choose folder",className="android.widget.TextView", resourceId="android:id/action_bar_title").exists:
                    print("choose inbox folder for email")
                    d(text="Inbox",className="android.widget.TextView", resourceId="com.android.email:id/name").click()
                    time.sleep(2)
                else:
                    print("drap email widget to launcher fail")
            else:
                print("No found email widget")
            d.press.back()
            time.sleep(2)

        else:
            print("No found widgets button")
        d.press.back()
        time.sleep(2)
コード例 #2
0
    def run(self, dispatcher, tracker, domain):
        app_name = tracker.get_slot("app")
        print('Performing launch application operation on', app_name)

        sleep(2.0)
        if d.press.home():
            pass
        else:
            print('Unable to launch Home Screen')
            return [SlotSet('app', False)]

        sleep(2.0)
        if d(scrollable=True).scroll(steps=50):
            pass
        else:
            print('Unable to launch App Screen')
            return [SlotSet('app', False)]

        sleep(2.0)
        for i in range(10):
            if d(text="Settings").wait.exists(timeout=500):
                d(text='Settings').click()
                return [SlotSet('app', app_name)]
            d.drag(0,
                   d.info['displayHeight'] - 100,
                   0,
                   d.info['displayWidth'] + 100,
                   steps=5)
            sleep(1.0)

        print('Unable to Locate / Launch app')
        return [SlotSet('app', False)]
コード例 #3
0
ファイル: android44.py プロジェクト: fxlysm/PYAndroid_Test
    def test_settings_view(self):
        d.press.home()
        time.sleep(2)
        d.press.menu()
        time.sleep(2)
        d(text="Settings",className="android.widget.TextView", resourceId="com.android.launcher3:id/settings_button").click()
        time.sleep(2)
        arr =["Bluetooth","Data usage","Audio profiles","Display","Storage","Battery","Apps","Location","Security","Accessibility","Printing","About phone"]

            #            "Language & input","Backup & reset","Add account","Date & time","Scheduled power on & off","Accessibility","Printing","About phone"]
            #
        for i in range(0, 12):
            if  d(text=arr[i],className="android.widget.TextView").exists:
                print("View "+arr[i])

            else:
                while not d(text=arr[i],className="android.widget.TextView").exists:
                    # print()
                    d.drag(100, 350, 100, 50, steps=100)


            d(text=arr[i],className="android.widget.TextView").click()

            if d(text="Unfortunately, Settings has stopped.").exists:
                print("When runing "+arr[i]+",Settings Crash")
                d(text="OK").click()
                return
            time.sleep(2)
            d.press.back()
            time.sleep(2)
コード例 #4
0
ファイル: android44.py プロジェクト: fxlysm/PYAndroid_Test
    def test_add_email_account(self):
        print("Test Add email account")
        d(className="android.view.View",resourceId="com.android.launcher3:id/layout").\
            child(description="Apps",className="android.widget.TextView").click()
        while not d(text="Email",className="android.widget.TextView").exists:
            d.drag(600, 480, 50, 480, steps=100);
            time.sleep(2)
        d(text="Email",className="android.widget.TextView").click()
        time.sleep(2)
        if d(text="Account setup",className="android.widget.TextView").exists:
            print("Frist add email account")
            d(text="Email address",className="android.widget.MultiAutoCompleteTextView",resourceId="com.android.email:id/account_email").settext("*****@*****.**")
            time.sleep(2)
            d(description="Password",className="android.widget.EditText",resourceId="com.android.email:id/account_password").settext("liu3763455")
            time.sleep(2)
            d(text="Next",className="android.widget.Button",resourceId="com.android.email:id/next").click()
            time.sleep(4)
            if d(text="Couldn't open connection to server.",className="android.widget.TextView",resourceId="android:id/message").exists:
                print("No network or some other error")
                d.press.back()
                time.sleep(2)
                # d(text="Couldn't finish",className="android.widget.TextVNiew",resourceId="android:id/alertTitle").click()
            if d(text="Power saving option",className="android.widget.TextView",resourceId="android:id/message").exists:
                print("")
                d(text="OK").click()
                time.sleep(2)
            d(text="Next",className="android.widget.Button",resourceId="com.android.email:id/next").click()
            time.sleep(2)
            d(text="Next",className="android.widget.Button",resourceId="com.android.email:id/next").click()
            time.sleep(2)


        else:
            print("Email have other account")
            d.press.menu()
            time.sleep(2)
            d(test="Settings").click()
            time.sleep(2)
            if d(text="Add account").exists:
                d(text="Add account").click()
                print("add other email account")
                time.sleep(2)
                d(text="Email address",className="android.widget.MultiAutoCompleteTextView",resourceId="com.android.email:id/account_email").settext("*****@*****.**")
                time.sleep(2)
                d(description="Password",className="android.widget.EditText",resourceId="com.android.email:id/account_password").settext("liu3763455")
                time.sleep(2)
                d(text="Next",className="android.widget.Button",resourceId="com.android.email:id/next").click()
                time.sleep(2)
                if d(text="Couldn't open connection to server.",className="android.widget.TextView",resourceId="android:id/message").exists:
                    d.press.back()
                    time.sleep(2)
                if d(text="Power saving option",className="android.widget.TextView",resourceId="android:id/message").exists:
                    d(text="OK").click()
                    time.sleep(2)
                d(text="Next",className="android.widget.Button",resourceId="com.android.email:id/next").click()
                time.sleep(2)
                d(text="Next",className="android.widget.Button",resourceId="com.android.email:id/next").click()
                time.sleep(2)
コード例 #5
0
ファイル: android44.py プロジェクト: dcn01/PYAndroid_Test
 def test_edit_new_email(self):
     print("Test Add email account")
     d(className="android.view.View",resourceId="com.android.launcher3:id/layout").\
         child(description="Apps",className="android.widget.TextView").click()
     while not d(text="Email", className="android.widget.TextView").exists:
         d.drag(600, 480, 50, 480, steps=100)
         print("Finding Email APP")
     d(text="Email", className="android.widget.TextView").click()
     time.sleep(2)
コード例 #6
0
ファイル: android44.py プロジェクト: fxlysm/PYAndroid_Test
 def test_edit_new_email(self):
     print("Test Add email account")
     d(className="android.view.View",resourceId="com.android.launcher3:id/layout").\
         child(description="Apps",className="android.widget.TextView").click()
     while not d(text="Email",className="android.widget.TextView").exists:
          d.drag(600, 480, 50, 480, steps=100);
          print("Finding Email APP")
     d(text="Email",className="android.widget.TextView").click()
     time.sleep(2)
コード例 #7
0
ファイル: android44.py プロジェクト: dcn01/PYAndroid_Test
 def test_add_contacts_phone(self):
     d.press.back()
     time.sleep(2)
     d.press.home()
     time.sleep(2)
     print("Add contacts to Phone")
     d(className="android.view.View",resourceId="com.android.launcher3:id/layout").\
         child(description="Apps",className="android.widget.TextView").click()
     time.sleep(2)
     while not d(text="People", className="android.widget.TextView").exists:
         d.drag(240, 360, 5, 360, steps=10)
         time.sleep(2)
     d(text="People", className="android.widget.TextView").click()
     time.sleep(2)
コード例 #8
0
ファイル: android44.py プロジェクト: fxlysm/PYAndroid_Test
 def test_add_contacts_phone(self):
     d.press.back()
     time.sleep(2)
     d.press.home()
     time.sleep(2)
     print("Add contacts to Phone")
     d(className="android.view.View",resourceId="com.android.launcher3:id/layout").\
         child(description="Apps",className="android.widget.TextView").click()
     time.sleep(2)
     while not d(text="People",className="android.widget.TextView").exists:
         d.drag(240, 360, 5, 360, steps=10)
         time.sleep(2)
     d(text="People",className="android.widget.TextView").click()
     time.sleep(2)
コード例 #9
0
def scroll_chat_list(conversation_elements, scrolling_size=0.5):
    """A partir da tela com a lista de conversas, realiza um 'scroll' para cima.
    conversation_elements -- Retorno de Selector 'find_element' para a SCREEN_NEXT_SELECTOR[Screen.CHAT_LIST]
    scrolling_size -- Quantidade de tela que deverá ser feito scroll
    Retorna a tela atualizada, após o scroll, selecionada pelo Selector"""

    if scrolling_size <= 0 or scrolling_size > 1:
        logger.debug(
            'Não é possível realizar "scroll" da tela com o parâmetro passado. Utilizando valor padrão 0.5'
        )
        scrolling_size = 0.5

    c_len = len(conversation_elements)
    c_pickscroll = int(c_len * scrolling_size)
    c1 = conversation_elements[0].info['bounds']
    c2 = conversation_elements[c_pickscroll].info['bounds']

    tsteps = round(c_pickscroll * 10)  # 10 steps por mensagem

    pixels = c2['top'] - c1['top']
    ret = DEVICE.drag(c2['left'],
                      c2['top'],
                      c1['left'],
                      c1['top'],
                      steps=tsteps)
    if ret:
        logger.debug(f'[SCROLL] {pixels} pixels, em {tsteps} passos')
    else:
        logger.debug(f'[SCROLL] Drag retornou: {ret}')
    return ret
コード例 #10
0
ファイル: android44.py プロジェクト: dcn01/PYAndroid_Test
    def test_launcher_widgets(self):
        print("Test Widgets")
        d.press.back()
        time.sleep(2)
        d.press.home()
        time.sleep(2)
        d.press.menu()
        if d(text="Widgets",
             className="android.widget.TextView",
             resourceId="com.android.launcher3:id/widget_button").exists:
            print("Found Widgets")
            d(text="Widgets",
              className="android.widget.TextView",
              resourceId="com.android.launcher3:id/widget_button").click()
            time.sleep(2)
            while not d(
                    text="Email",
                    className="android.widget.TextView",
                    resourceId="com.android.launcher3:id/widget_name").exists:
                d.swipe(400, 500, 50, 500, steps=50)
            if d(className="android.widget.LinearLayout").child(
                    text="Email",
                    className="android.widget.TextView",
                    resourceId="com.android.launcher3:id/widget_name").exists:
                print("swipe email widget to launcher")
                d.drag(360, 200, 480, 200, steps=100)
                time.sleep(2)
                if d(text="Choose folder",
                     className="android.widget.TextView",
                     resourceId="android:id/action_bar_title").exists:
                    print("choose inbox folder for email")
                    d(text="Inbox",
                      className="android.widget.TextView",
                      resourceId="com.android.email:id/name").click()
                    time.sleep(2)
                else:
                    print("drap email widget to launcher fail")
            else:
                print("No found email widget")
            d.press.back()
            time.sleep(2)

        else:
            print("No found widgets button")
        d.press.back()
        time.sleep(2)
コード例 #11
0
ファイル: TaoBao_Trial.py プロジェクト: Rockyzsu/TaobaoTrial
def apply_one(kind_x, kind_y):
    # apply for 4 production
    dis_x = 540
    dis_y= 784.5
    base_x = 270
    base_y = 743.25
    d.click(kind_x, kind_y)
    time.sleep(5)
    select_product(base_x, base_y)
    select_product(base_x + dis_x, base_y)
    select_product(base_x, base_y + dis_y)
    select_product(base_x + dis_x, base_y + dis_y)
    #add drag down action
    d.drag(270,1527.75,270,743.25,steps=200)
    select_product(base_x, base_y)
    select_product(base_x + dis_x, base_y)
    select_product(base_x, base_y + dis_y)
    select_product(base_x + dis_x, base_y + dis_y)
コード例 #12
0
ファイル: TaoBao_Trial.py プロジェクト: msdgwzhy6/TaobaoTrial
def apply_one(kind_x, kind_y):
    # apply for 4 production
    dis_x = 540
    dis_y = 784.5
    base_x = 270
    base_y = 743.25
    d.click(kind_x, kind_y)
    time.sleep(5)
    select_product(base_x, base_y)
    select_product(base_x + dis_x, base_y)
    select_product(base_x, base_y + dis_y)
    select_product(base_x + dis_x, base_y + dis_y)
    #add drag down action
    d.drag(270, 1527.75, 270, 743.25, steps=200)
    select_product(base_x, base_y)
    select_product(base_x + dis_x, base_y)
    select_product(base_x, base_y + dis_y)
    select_product(base_x + dis_x, base_y + dis_y)
コード例 #13
0
ファイル: android44.py プロジェクト: dcn01/PYAndroid_Test
    def test_settings_view(self):
        d.press.home()
        time.sleep(2)
        d.press.menu()
        time.sleep(2)
        d(text="Settings",
          className="android.widget.TextView",
          resourceId="com.android.launcher3:id/settings_button").click()
        time.sleep(2)
        arr = [
            "Bluetooth", "Data usage", "Audio profiles", "Display", "Storage",
            "Battery", "Apps", "Location", "Security", "Accessibility",
            "Printing", "About phone"
        ]

        #            "Language & input","Backup & reset","Add account","Date & time","Scheduled power on & off","Accessibility","Printing","About phone"]
        #
        for i in range(0, 12):
            if d(text=arr[i], className="android.widget.TextView").exists:
                print("View " + arr[i])

            else:
                while not d(text=arr[i],
                            className="android.widget.TextView").exists:
                    # print()
                    d.drag(100, 350, 100, 50, steps=100)

            d(text=arr[i], className="android.widget.TextView").click()

            if d(text="Unfortunately, Settings has stopped.").exists:
                print("When runing " + arr[i] + ",Settings Crash")
                d(text="OK").click()
                return
            time.sleep(2)
            d.press.back()
            time.sleep(2)
コード例 #14
0
ファイル: interfacer.py プロジェクト: johnliu/chimp
 def drag(cls, start, end, duration):
     step_size = 25.0 / 1000
     device.drag(start[0], start[1], end[0], end[1], int(duration / step_size))
コード例 #15
0
def testmethod_4():
    '''<case_id>82</case_id>'''
    print "Method testmethod_3 in class ARP&PING function test suite"
    print "Method The target is out of the same subnet: ARP response not received in ARP&PING function test suite"
    try:
        d(description='Apps').click()
        d(text='LinkRunner G2').click()
        time.sleep(5)
        d.click(0, 28)
        time.sleep(2)
        #d.drag(6,594,6,138)
        d(resourceId='com.flukenetworks.yilian.prototype:id/set_text').click()
        time.sleep(2)
        d.drag(6, 720, 6, 197)
        d(resourceId='com.flukenetworks.yilian.prototype:id/spinner_ip_config'
          ).click()
        time.sleep(0.5)
        d(text='Static').click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/ip_address_edit'
          ).click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/edit').set_text(
            "192.168.10.63")
        d(resourceId='android:id/button1').click()
        time.sleep(1)
        d(resourceId='com.flukenetworks.yilian.prototype:id/subnet_mask_edit'
          ).click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/edit').set_text(
            "255.255.255.0")
        d(resourceId='android:id/button1').click()
        time.sleep(1)
        d(resourceId='com.flukenetworks.yilian.prototype:id/gateway_edit'
          ).click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/edit').set_text(
            "192.168.10.1")
        d(resourceId='android:id/button1').click()
        time.sleep(1)
        d(resourceId='com.flukenetworks.yilian.prototype:id/dns1_edit').click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/edit').set_text(
            "192.168.10.1")
        d(resourceId='android:id/button1').click()
        time.sleep(1)
        d(resourceId='com.flukenetworks.yilian.prototype:id/dns2_edit').click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/edit').set_text(
            "192.168.10.1")
        d(resourceId='android:id/button1').click()
        time.sleep(1)
        d.drag(6, 724, 6, 90)
        d(resourceId='com.flukenetworks.yilian.prototype:id/add_target').click(
        )
        d(resourceId='com.flukenetworks.yilian.prototype:id/target_address'
          ).click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/edit').set_text(
            "192.168.20.1")
        d(resourceId='android:id/button1').click()
        d(resourceId='com.flukenetworks.yilian.prototype:id/test_type_switch'
          ).click()  ###disable tcp###
        d.press.back()
        time.sleep(1)
        d.press.back()
        time.sleep(50)
        static_results = d(
            resourceId='com.flukenetworks.yilian.prototype:id/static_image'
        ).description
        print(static_results)
        string_static = str(static_results)
        assert string_static == 'green'
        static_value = d(
            resourceId='com.flukenetworks.yilian.prototype:id/static_text'
        ).text
        static_str = str(static_value)
        assert static_str == "192.168.10.63"

        target_results = d(
            resourceId='com.flukenetworks.yilian.prototype:id/target_image'
        ).description
        print(target_results)
        string_target = str(target_results)
        assert string_target != 'red'

        d(resourceId='com.flukenetworks.yilian.prototype:id/target_text'
          ).click()
        target_address = d(
            resourceId=
            'com.flukenetworks.yilian.prototype:id/target_address_desc').text
        print(target_address)
        string_target_address = str(target_address)
        assert string_target_address == '192.168.20.1'

        target_type = d(
            resourceId='com.flukenetworks.yilian.prototype:id/target_type_desc'
        ).text
        print(target_type)
        string_target_type = str(target_type)
        assert string_target_type == 'PING'

        tcp_ping_time = d(
            resourceId='com.flukenetworks.yilian.prototype:id/ping_time').text
        print(tcp_ping_time)
        string_tcp_ping_time = str(tcp_ping_time)
        assert string_tcp_ping_time != ' --, --, --'

        cloud_status = d(
            resourceId='com.flukenetworks.yilian.prototype:id/cloud_image'
        ).description
        print(cloud_status)
        string_cloud_status = str(cloud_status)
        assert string_cloud_status == 'green'

        cloud_value = d(
            resourceId='com.flukenetworks.yilian.prototype:id/cloud_text').text
        cloud_str = str(cloud_value)
        assert cloud_str == "Link-Live.com"
        d.press.back()
        time.sleep(1)
        d.press.back()

    except Exception as e:
        print(e)
        #return False
        a = os.popen('adb shell ps | grep com.flukenetworks.yilian.prototype'
                     ).readlines()[0]
        lis = a.split()
        lis1 = int(lis[1])
        os.system('adb shell kill -9 %d' % lis1)
        d.press.back()
        time.sleep(6)
        #return False
        assert False
コード例 #16
0
ファイル: android44.py プロジェクト: dcn01/PYAndroid_Test
    def test_add_email_account(self):
        print("Test Add email account")
        d(className="android.view.View",resourceId="com.android.launcher3:id/layout").\
            child(description="Apps",className="android.widget.TextView").click()
        while not d(text="Email", className="android.widget.TextView").exists:
            d.drag(600, 480, 50, 480, steps=100)
            time.sleep(2)
        d(text="Email", className="android.widget.TextView").click()
        time.sleep(2)
        if d(text="Account setup", className="android.widget.TextView").exists:
            print("Frist add email account")
            d(text="Email address",
              className="android.widget.MultiAutoCompleteTextView",
              resourceId="com.android.email:id/account_email").settext(
                  "*****@*****.**")
            time.sleep(2)
            d(description="Password",
              className="android.widget.EditText",
              resourceId="com.android.email:id/account_password").settext(
                  "liu3763455")
            time.sleep(2)
            d(text="Next",
              className="android.widget.Button",
              resourceId="com.android.email:id/next").click()
            time.sleep(4)
            if d(text="Couldn't open connection to server.",
                 className="android.widget.TextView",
                 resourceId="android:id/message").exists:
                print("No network or some other error")
                d.press.back()
                time.sleep(2)
                # d(text="Couldn't finish",className="android.widget.TextVNiew",resourceId="android:id/alertTitle").click()
            if d(text="Power saving option",
                 className="android.widget.TextView",
                 resourceId="android:id/message").exists:
                print("")
                d(text="OK").click()
                time.sleep(2)
            d(text="Next",
              className="android.widget.Button",
              resourceId="com.android.email:id/next").click()
            time.sleep(2)
            d(text="Next",
              className="android.widget.Button",
              resourceId="com.android.email:id/next").click()
            time.sleep(2)

        else:
            print("Email have other account")
            d.press.menu()
            time.sleep(2)
            d(test="Settings").click()
            time.sleep(2)
            if d(text="Add account").exists:
                d(text="Add account").click()
                print("add other email account")
                time.sleep(2)
                d(text="Email address",
                  className="android.widget.MultiAutoCompleteTextView",
                  resourceId="com.android.email:id/account_email").settext(
                      "*****@*****.**")
                time.sleep(2)
                d(description="Password",
                  className="android.widget.EditText",
                  resourceId="com.android.email:id/account_password").settext(
                      "liu3763455")
                time.sleep(2)
                d(text="Next",
                  className="android.widget.Button",
                  resourceId="com.android.email:id/next").click()
                time.sleep(2)
                if d(text="Couldn't open connection to server.",
                     className="android.widget.TextView",
                     resourceId="android:id/message").exists:
                    d.press.back()
                    time.sleep(2)
                if d(text="Power saving option",
                     className="android.widget.TextView",
                     resourceId="android:id/message").exists:
                    d(text="OK").click()
                    time.sleep(2)
                d(text="Next",
                  className="android.widget.Button",
                  resourceId="com.android.email:id/next").click()
                time.sleep(2)
                d(text="Next",
                  className="android.widget.Button",
                  resourceId="com.android.email:id/next").click()
                time.sleep(2)
コード例 #17
0
def auto_task(times):
    first_start = True
    count = 0
    while True:
        try:
            have_task = False
            d.screenshot(pic_name)
            print('find entry')
            if not judge.is_exploration_in_page(pic_name):
                print('not entry page')
                if not first_start:
                    warning()
                    return
            else:
                click_range(1066, 604)
                print('entry')
                time.sleep(2)
                d.drag(1300, 130, 800, 130, 10)
            first_start = False
            move_times = 0
            retry_times = 0
            while True:
                d.screenshot(pic_name)
                print('find boss')
                pos = judge.get_attack_boss_pos(pic_name)
                if pos:
                    print('challenge in boss')
                    if not attack_boss(pos):
                        return
                    count += 1
                    print('count', count)
                    if count == times:  # finish
                        warning()
                        return
                    break
                print('no boss, find task goblin')
                pos = get_task_goblin()
                if pos:
                    have_task = True
                    click_range(pos[0], pos[1])
                    print('challenge in goblin')
                    time.sleep(1)
                    d.screenshot(pic_name)
                    if judge.is_quit_page(pic_name):
                        retry_times += 1
                        if retry_times >= 5:
                            warning()
                            return
                        print('challenge in failed retry', retry_times)
                        continue
                    time.sleep(5)
                    d.screenshot(pic_name)
                    if not judge.is_battle_page(pic_name):
                        retry_times += 1
                        if retry_times >= 5:
                            warning()
                            return
                        print('challenge in failed retry', retry_times)
                        continue
                    print('challenge in success')
                    retry_times = 0
                    if not wait_for_end():
                        warning()
                        return
                    count += 1
                    print('count', count)
                    if count == times:  # finish
                        warning()
                        return
                    continue
                print('no goblin')
                if move_times < 2:
                    print('go right', move_times)
                    d.drag(1300, 130, 300, 130, 10)
                    # click_range(pos_x, 570)  # right
                else:
                    print('quit exploration after 2 times')
                    if quit_tansuo():
                        break
                    warning()
                    return
                move_times += 1
                time.sleep(3)
            if not have_task:
                print('no tasks goblin')
                warning()
                return
        except Exception as e:
            print(e)
            print(traceback.format_exc())
            warning()
コード例 #18
0
ファイル: ui_deep.py プロジェクト: majestyhao/uidroid
#-*-encoding:utf-8-*-
from uiautomator import device as dev
import xml.dom.minidom
import time
import os

print dev.info
dev.screen.on()
os.system('rm -r -f data')
os.system('mkdir data')


CMD_MAP = {
    'CLICK': lambda dev, arg: dev(**arg).click(),
    'TOUCH': lambda dev, arg: dev.click(**arg),
    'DRAG': lambda dev, arg: dev.drag(**arg),
    'PRESS': lambda dev, arg: dev.press(**arg),
    'WAIT': lambda dev, arg: dev.wait.update() # wait until window update event occurs
    }

import Queue
import subprocess
import threading
import re # reg exp

class AsynchronousFileReader(threading.Thread):
    '''
    Helper class to implement asynchronous reading of a file
    in a separate thread. Pushes read lines on a queue to
    be consumed in another thread.
    '''
コード例 #19
0
def shoot_to(x, y):
    print("target", x, y)
    d.drag(get_ball_middle_x(), get_ball_middle_y(), x, y, steps=10)
コード例 #20
0
def shoot_to(x, y):
    print "target", x, y
    d.drag(get_ball_middle_x(), get_ball_middle_y(), x, y, steps=10)