Beispiel #1
0
 def test_lock_unlock(self):
     for i in xrange(2):
         self.checkScreen()
         d.click(1380, 800)
         time.sleep(2)
         self.inputCode()
         time.sleep(2)
         d.sleep()
         time.sleep(2)
Beispiel #2
0
def task():
    startGame()
    city1()
    city2()
    city3()
    city4()
    # city5()
    home()
    d.sleep()
    def auto_clock(self, clock_time):
        current_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                     time.localtime(time.time()))
        if clock_time[1] >= current_time >= clock_time[
                0] or current_time > clock_time[1]:
            self.wakeup_input_passward()
            parse_succuss = False
            while not parse_succuss:
                Phone.press.home()
                time.sleep(1)
                Phone(text="享用").click()
                time.sleep(7)
                Phone(text="考勤打卡").click()
                self.run_log("After waiting 10 seconds, clock in...")
                time.sleep(10)

                try:
                    # pull_screenshot('screenshot.png')
                    # im = Image.open('./{}'.format('screenshot.png'))
                    #position = self.find_clockin_pos_from_image(im)
                    position = [363, 820]
                    parse_succuss = True
                except IndexError:
                    Phone.press.back()

            # Phone.click(533, 1262)  # 上下班打卡
            Phone.click(position[0], position[1])
            self.run_log("The time of clock in: " + time.strftime(
                "%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
            time.sleep(10)
            file_name = time.strftime(
                "./clockin_record/%Y-%m-%d_%H-%M-%S_record.jpg",
                time.localtime(time.time()))
            pull_screenshot(file_name)
            time.sleep(3)
            Phone.press.back()
            time.sleep(1)
            Phone.press.back()
            Phone.sleep()
            return 1
        else:
            self.run_log("The time of clock-in don't come in... %s" %
                         current_time)
            return 0
def sleep_mode():
	"""Sleep the device"""
	d.sleep()
Beispiel #5
0
 def checkScreen(self):
     d.sleep()
     if d.screen == "off":  # of d.screen != "on"
         d.wakeup()
         time.sleep(2)
Beispiel #6
0
#!/usr/bin/python
from uiautomator import device as d

import time

# 开关屏幕50次
for i in range(1,50):
    d.sleep()
    time.sleep(0.2)
    d.wakeup()
    time.sleep(0.2)
    # 新增wrapper,检查屏幕是否开启
    # 若没有开启则不正常
    if not d.screen.ison()
        print("第" + i + "次没有正常开启屏幕")
Beispiel #7
0
def sleep():
    d.sleep()
Beispiel #8
0
def task1():
    startGame()
    selectCity(1)
    upgrade(4, "sy")
    home()
    d.sleep()