コード例 #1
0
 def setUp(self):
     if configure.device_name == '':
         self.driver = atx.connect()
     else:
         self.driver = atx.connect(configure.device_name)
     self.driver.start_app(configure.package_name, configure.activity_name)
     sleep(25)
コード例 #2
0
 def setUp(self):
     if configure.device_name == '':
         self.driver = atx.connect()
     else:
         self.driver = atx.connect(configure.device_name)
     # self.driver.start_app(configure.package_name,configure.activity_name)  # 如果设备未连接,默认启动
     log.info('测试开始')
コード例 #3
0
ファイル: tkgui.py プロジェクト: diandianhanbin/AutomatorX
def main(serial, host='127.0.0.1', port=5037, platform='android'):
    log.debug("gui starting ...")
    if platform == 'android':
        d = atx.connect(serial, host=host, port=port)
        serial = d.serial
    elif platform == 'ios':
        d = atx.connect(udid=serial, platform='ios')
        serial = d.udid
    gui = CropIDE('ATX GUI SN: %s' % serial, device=d)
    gui.mainloop()
コード例 #4
0
ファイル: task.py プロジェクト: gszhangwei/Sleep-Early
 def launch(self, device):
     if device == 'android':
         driver = atx.connect()
         set_delay(0.5)
     elif device == 'ios':
         with open('session_id_ios') as fl:
             sid = fl.read()
         driver = atx.connect('http://localhost:8100')
         driver._session = wda.Session('http://localhost:8100', sid)
     else:
         raise IOError('Invalid device type!!!')
     driver.image_path = ['.', 'images']
     return driver
コード例 #5
0
 def launch(device):
     if device == 'android':
         driver = atx.connect()
         set_delay(1)
     elif device == 'ios':
         import subprocess
         from pages.steps.path_manager import ipr
         subprocess.Popen([ipr(), '8100', '8100'])
         driver = atx.connect('http://localhost:8100')
         set_delay(-0.5)
     else:
         raise IOError('Invalid device type!!!')
     atx.drivers.mixin.log.setLevel(50)
     return driver
コード例 #6
0
ファイル: calculator.py プロジェクト: lijinzhou2016/xinwei
 def setUp(self):
     self._logger = log
     self._driver = atx.connect()
     # self._sdriver=Device("")
     self._mdriver = Common(self._driver, self._logger)
     if not self._mdriver.start_app():
         exit(-1)
コード例 #7
0
ファイル: __main__.py プロジェクト: zeroyou/weditor
 def post(self):
     platform = self.get_argument("platform").lower()
     device_url = self.get_argument("deviceUrl")
     id = str(uuid.uuid4())
     try:
         if platform == 'android':
             import uiautomator2 as u2
             d = u2.connect(device_url)
             d.platform = 'android'
             cached_devices[id] = d
         elif platform == 'ios':
             import atx
             d = atx.connect(device_url)
             cached_devices[id] = d
         else:
             import neco
             d = neco.connect(device_url or 'localhost')
             cached_devices[id] = d
     except Exception as e:
         self.set_status(430, "Connect Error")
         self.write({
             "success": False,
             "description": traceback.format_exc().encode('utf-8'),
         })
     else:
         self.write({
             "deviceId": id,
             'success': True,
         })
コード例 #8
0
ファイル: server.py プロジェクト: ijasonyi/atx-webide
    def post(self):
        '''connect device'''
        global device, atx_settings
        serial = self.get_argument('serial').strip()

        # check if device is alive, should be in drivers?
        if device is not None:
            if hasattr(device, 'serial') and serial == device.serial:
                if device.serial.startswith('http://'):
                    self.write({'status': 'ok'})
                    return
                elif AdbClient().devices().get(serial) == 'device':
                    self.write({'status': 'ok'})
                    return

        # wrapping args, should be in drivers? identifier?
        atx_connect_url = atx_settings['device_url'] = serial.encode('utf-8') # used in set env-var SERIAL
        device = atx.connect(atx_connect_url)

        if device.platform == 'ios':
            info = device.status()
            setattr(device, 'serial', serial)
        else:
            info = device.info
        self.write({'status': 'ok', 'info': info})
コード例 #9
0
ファイル: __main__.py プロジェクト: shiguangking/weditor
 def post(self):
     platform = self.get_argument("platform").lower()
     device_url = self.get_argument("deviceUrl")
     id = str(uuid.uuid4())
     try:
         if platform == 'android':
             import uiautomator2 as u2
             d = u2.connect(device_url)
             d.platform = 'android'
             cached_devices[id] = d
         elif platform == 'ios':
             import atx
             d = atx.connect(device_url)
             cached_devices[id] = d
         else:
             import neco
             d = neco.connect(device_url or 'localhost')
             cached_devices[id] = d
     except Exception as e:
         self.set_status(430, "Connect Error")
         self.write({
             "success": False,
             "description": traceback.format_exc().encode('utf-8'),
         })
     else:
         self.write({
             "deviceId": id,
             'success': True,
         })
コード例 #10
0
ファイル: tkgui.py プロジェクト: codeskyblue/AutomatorX
def main(serial, host='127.0.0.1', scale=0.5, platform=None):
    log.debug("gui starting(scale: {}) ...".format(scale))
    if platform == 'android':
        d = atx.connect(serial, host=host, platform='android')
        serial = d.serial
    elif platform == 'ios':
        d = atx.connect(serial, platform='ios')
        serial = serial
    else:
        d = atx.connect(serial)
        serial = serial
        # d = ioskit.Device(udid=serial)
        # d = atx.connect(udid=serial, platform='ios')
        # serial = d.udid
    gui = CropIDE('ATX GUI SN: %s' % serial, ratio=scale, device=d)
    gui.mainloop()
コード例 #11
0
def main(serial, host='127.0.0.1', scale=0.5, platform=None):
    log.debug("gui starting(scale: {}) ...".format(scale))
    if platform == 'android':
        d = atx.connect(serial, host=host, platform='android')
        serial = d.serial
    elif platform == 'ios':
        d = atx.connect(serial, platform='ios')
        serial = serial
    else:
        d = atx.connect(serial)
        serial = serial
        # d = ioskit.Device(udid=serial)
        # d = atx.connect(udid=serial, platform='ios')
        # serial = d.udid
    gui = CropIDE('ATX GUI SN: %s' % serial, ratio=scale, device=d)
    gui.mainloop()
コード例 #12
0
ファイル: driver.py プロジェクト: songoex/atxdemo
 def init_ios_driver(self, device_name):
     try:
         d = atx.connect("http://localhost:8100")
         d.start_app(bundle_id)
         time.sleep(5)
         return d
     except Exception as e:
         logger.info("初始化ios端driver异常!{}".format(e))
コード例 #13
0
 def setUp(self):
     self.driver = atx.connect('http://localhost:8100', platform='ios')
     # self.driver.home()
     # self.report = Report(self.driver, save_dir=config.CASE_REPORT_PATH + self._testMethodName)
     # self.report.info("Test Start")
     self.driver.start_app(config.PACKAGE_NAME)
     if self.driver(label=u"Rate 2Call", name=u"Rate 2Call", className="StaticText").exists:
         self.driver(label=u"No, thanks").click()
コード例 #14
0
ファイル: test_dummy.py プロジェクト: codeskyblue/AutomatorX
def test_screenshot_always_fail():
    import types
    d = atx.connect(platform='dummy')

    def raise_ioerror(self):
        raise IOError('error of io')

    d._take_screenshot = types.MethodType(raise_ioerror, d)
    with pytest.raises(IOError):
        d.screenshot()
コード例 #15
0
ファイル: test_dummy.py プロジェクト: zhoujinjian/AutomatorX
def test_screenshot_always_fail():
    import types
    d = atx.connect(platform='dummy')

    def raise_ioerror(self):
        raise IOError('error of io')

    d._take_screenshot = types.MethodType(raise_ioerror, d)
    with pytest.raises(IOError):
        d.screenshot()
コード例 #16
0
ファイル: tkgui.py プロジェクト: qezt/AutomatorX
def main(serial, host='127.0.0.1', platform='android'):
    log.debug("gui starting ...")
    if platform == 'android':
        d = atx.connect(serial, host=host)
        serial = d.serial
    elif platform == 'ios':
        d = ioskit.Device(udid=serial)
        # d = atx.connect(udid=serial, platform='ios')
        serial = d.udid
    gui = CropIDE('ATX GUI SN: %s' % serial, device=d)
    gui.mainloop()
コード例 #17
0
ファイル: webide.py プロジェクト: 917228145/AutomatorX
    def get(self):
        d = atx.connect(**atx_settings)
        d.screenshot('_screen.png')

        self.set_header('Content-Type', 'image/png')
        with open('_screen.png', 'rb') as f:
            while 1:
                data = f.read(16000)
                if not data:
                    break
                self.write(data)
        self.finish()
コード例 #18
0
    def get(self):
        d = atx.connect(**atx_settings)
        d.screenshot('_screen.png')

        self.set_header('Content-Type', 'image/png')
        with open('_screen.png', 'rb') as f:
            while 1:
                data = f.read(16000)
                if not data:
                    break
                self.write(data)
        self.finish()
コード例 #19
0
ファイル: info.py プロジェクト: songjt1993/gitskills
def main(serial, host, port):
    d = atx.connect(serial, host=host, port=port)
    props = d.properties
    (w, h) = d.display
    info = {
        'serial': d.serial,
        'product.model': props['ro.product.model'],
        'product.brand': props.get('ro.product.brand'),
        'sys.country': props.get('persist.sys.country'),
        'display': '%dx%d' % (w, h),
        'version.sdk': int(props.get('ro.build.version.sdk', 0)),
        'version.release': props.get('ro.build.version.release'),
        'product.cpu.abi': props.get('ro.product.cpu.abi'),
    }
    print(json.dumps(info, indent=4))
コード例 #20
0
    def get(self):
        d = atx.connect(**atx_settings)
        v = self.get_argument('v')
        global latest_screen
        latest_screen = 'screenshots/screen_%s.png' % v
        d.screenshot(latest_screen)

        self.set_header('Content-Type', 'image/png')
        with open(latest_screen, 'rb') as f:
            while 1:
                data = f.read(16000)
                if not data:
                    break
                self.write(data)
        self.finish()
コード例 #21
0
def main(serial=None, host=None, port=None):
    d = atx.connect(serial, host=host, port=port)
    while True:
        pilimg = d.screenshot()
        cv2img = imutils.from_pillow(pilimg)
        # cv2img = cv2.imread('tmp.png')
        # cv2.imwrite('tmp.png', cv2img)
        cv2img = cv2.resize(cv2img, fx=0.5, fy=0.5, dsize=(0, 0))
        pt = choose_point(cv2img)
        print 'click:', pt
        if pt:
            x, y = pt
            d.click(2*x, 2*y)
        cv2.waitKey(100)
        # import time
        # time.sleep(0.1)
コード例 #22
0
ファイル: test.py プロジェクト: wuyisheng/ATX
def run():
    d = atx.connect()
    d.press_home()
    d.click(704, 1296)
    try:
        d.click_image(r"../../../Desktop/setting.1920x1080.png")
    except Exception as error:
        print error
    try:
        d.wait(r"../../../Desktop/timeline.1920x1080.png")
    except Exception as error:
        print error
    d.click_image(r"../../../Desktop/timeline.1920x1080.png")
    d.screenshot()
    print d.exists(
        local_object_path=r"../../../Desktop/show_chart.1920x1080.png")
    d.press_back()
    d.press_back()
コード例 #23
0
ファイル: android.py プロジェクト: queenaLou/utils
def screenshot_minicap(adir, info):
    """使用minicap,会自动根据手机当前方向旋转图片,用来作为bug截图最为合适

    :param adir:
    :param info:
    :return:
    """
    print "开始截图..."
    temp = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime(time.time()))
    filename = '{0}-{1}.png'.format(temp,info)
    filename = os.path.join(adir,filename)
    import atx
    d = atx.connect()
    """ :type: atx.device.AndroidDevice"""

    d.screenshot_method = atx.SCREENSHOT_METHOD_MINICAP
    d.screenshot(filename)
    print 'result is {0}'.format(filename)
    execute_cmd("mspaint {0}".format(filename))
コード例 #24
0
    def __init__(self):

        # init image names
        self.image_name_of_back_to_map_of_world = "back_to_map_of_world.1920x1080.png"
        self.image_name_of_automatic = "automatic.1920x1080.png"
        self.image_name_of_challenge = "challenge.1920x1080.png"
        self.image_name_of_continue = "click_to_continue.1920x1080.png"
        self.image_name_of_ready = "ready.1920x1080.png"
        self.image_name_of_normal_enemy_sword = "sword.1920x1080.png"
        self.image_name_of_leader_enemy_sword = "leader_sword.1920x1080.png"
        self.image_name_of_gift = "fresh.1920x1080.png"
        self.image_name_of_gift_received = "gift_received.1920x1080.png"
        self.image_name_of_explore = "btn_explore.1920x1080.png"
        self.image_name_of_left_bottom_menu = "left_bottom_menu.1920x1080.png"
        self.image_name_of_chest = "chest.1920x1080.png"
        self.image_name_of_chapter = "chapter7.1920x1080.png"
        self.target_chapter_name = None

        self.d = atx.connect()
        self.d.image_path = ['.', 'assets']
コード例 #25
0
ファイル: test.py プロジェクト: wuyisheng/ATX
def report():
    d = atx.connect()
    rp = Report(d, save_dir='tasks/out/local.test')
    try:
        d.press_home()
        d.click(704, 1296)
        try:
            d.click_image(r"../../../Desktop/setting.1920x1080.png")
        except Exception as error:
            print error
        try:
            d.wait(r"../../../Desktop/timeline.1920x1080.png")
        except Exception as error:
            print error
        d.click_image(r"../../../Desktop/timeline.1920x1080.png")
        rp.info("timeline", screenshot=d.screenshot())
        rp.assert_image_exists(r"../../../Desktop/show_chart.1920x1080.png",
                               scanner=d.screen_image())
        d.press_back()
        d.press_back()
    except Exception as error1:
        print error1
    finally:
        rp.close()
コード例 #26
0
ファイル: blockly.py プロジェクト: 917228145/AutomatorX
# coding: utf-8
import os
import atx


__basename = os.path.basename(os.path.splitext(__file__)[0])
d = atx.connect(platform="android")
d.image_path = [".", "images", os.path.join("images", __basename)]

d.screenshot('screen.png')
if 0 == 0:
  print('你好')
  for count in range(1):
    print('Hello world')
print('Hello world')
コード例 #27
0
# coding: utf-8

import os
import time
import atx
import logging
from atx import consts
print 'Version:', atx.version

d = atx.connect(None)

# 你好


def screenshot():
    start = time.time()
    #d.screenshot_method = consts.SCREENSHOT_METHOD_MINICAP
    d.screenshot('ttt.png')
    print time.time() - start


def start_app():
    d.start_app('com.netease.txx')


def stop_app():
    d.stop_app('com.netease.txx', clear=True)


def touch():
    d.screenshot_method = consts.SCREENSHOT_METHOD_MINICAP
コード例 #28
0
ファイル: __main__.py プロジェクト: gszhangwei/Sleep-Early
 def setUp(self):
     self.d = atx.connect('http://localhost:8100')
     self.d.image_path = ['.', '../images']
コード例 #29
0
ファイル: tkgui.py プロジェクト: 917228145/AutomatorX
def atx_ide(serial):
    d = atx.connect(serial)
    gui = CropIDE('AirtestX IDE SN: %s' % serial, screenshot=d.screenshot)
    gui.draw_image(d.screenshot())
    gui.mainloop()
コード例 #30
0
ファイル: Mobile.py プロジェクト: disc9562/STV_final
 def __init__(self):
     import atx
     self.d = atx.connect()
コード例 #31
0
ファイル: test_ios.py プロジェクト: Andy-hpliu/AirtestX
def test_ios_screenshot():
	d = atx.connect(platform='ios')
	d.screen_rotation = 1
	print d.screenshot().save("yes.png")
コード例 #32
0
ファイル: click.py プロジェクト: bottotl/iOS-game-click
            # elif click_image(d, "level3.750x1334.png"):
            # 	print("chose level3")
            # 	break;
            # else :
            # 	pass;
            print("rechose")
            click(d, 336, 314)  #点第一个
            time.sleep(1)
            break

        while 1:
            print("start kaiqifuben")
            buchongtili(d)
            if click_image(d, "kaiqifuben.750x1334.png"):
                print("did start kaiqifuben")
                break

        gongji(d)

    click_image(d, "jixu.750x1334.png")
    click_image(d, "jixu.750x1334.png")
    click_image(d, "queding.750x1334.png")


d = atx.connect('http://172.16.44.19:8100', platform='ios')  # platform也可以不指定
print d.rotation
dis = d.display
while 1:
    cucai_jin(d)

#d.click_image("tiaozhan.1334x750.png")
コード例 #33
0
ファイル: test.py プロジェクト: 917228145/AutomatorX
# coding: utf-8

import os
import time
import atx
import logging
from atx import consts
print 'Version:', atx.version

d = atx.connect(None)


def screenshot():
    start = time.time()
    #d.screenshot_method = consts.SCREENSHOT_METHOD_MINICAP
    d.screenshot('ttt.png')
    print time.time() - start

def start_app():
    d.start_app('com.netease.txx')

def stop_app():
    d.stop_app('com.netease.txx', clear=True)

def touch():
    d.screenshot_method = consts.SCREENSHOT_METHOD_MINICAP
    d.touch_image('button.png')

if __name__ == '__main__':
    log = logging.getLogger('atx')
    log.setLevel(logging.DEBUG)
コード例 #34
0
 def __init__(self):
     self.dr = webdriver.Firefox()
     self.d = atx.connect()
コード例 #35
0
ファイル: tkgui.py プロジェクト: danbao/AirtestX
def main(serial, **kwargs):
    log.debug("GUI Started.")
    d = atx.connect(serial, **kwargs)
    d.wakeup()
    gui = CropIDE('AirtestX IDE SN: %s' % serial, device=d)
    gui.mainloop()
コード例 #36
0
 def setUp(self):
     self.d = atx.connect(platform='dummy')
     self.rp = Report(self.d, save_dir='tmp_report')
コード例 #37
0
 def build_exec_env(self):
     d = atx.connect()
     d.image_path.append(os.path.join(self.basedir, 'case'))
     self._env = {'time': time, 'd': d}
コード例 #38
0
ファイル: main.py プロジェクト: codeskyblue/cocbot
# coding: utf-8

import atx


d = atx.connect('com.netease.atx.apple', platform='ios')
d.delay(5)
assert d.current_app() == 'com.netease.atx.apple'
d.click(900, 900)
d.delay(3)
d.start_app('com.supercell.magic')

# train an army
d.click_image('army.2208x1242.png')
while True:
    d.click_image(atx.Pattern(r"next.2208x1242.png", offset=(42, 0)), timeout=20)
    d.delay(0.5)
    # train meizi
    p = d.exists('meizi.2208x1242.png')
    if p:
        for i in range(10):
            d.click(*p.pos)
        continue
    # check if finished.
    if d.exists('editarmy.2208x1242.png'):
        d.click_image('quit.2208x1242.png')
        break

print 'wait last operation'
d.delay(2)
コード例 #39
0
# coding: utf-8
import atx
from threading import Timer
import time
import pytesseract
from PIL import Image
import re
from threading import Thread

d = atx.connect('8ee8d717')  # 如果多个手机连接电脑,则需要填入对应的设备号
# d.disable_popups()
arena_round = 0


def clear_moods(inc):
    time.sleep(1)
    d.click_exists("imgs2/moods/[email protected]")
    time.sleep(1)
    d.click_exists("imgs2/moods/[email protected]")
    time.sleep(1)
    d.click_exists("imgs2/moods/[email protected]")
    time.sleep(1)
    d.click_exists("imgs2/moods/[email protected]")
    time.sleep(1)
    d.click_exists("imgs2/moods/[email protected]")
    time.sleep(1)
    d.click_exists("imgs2/moods/[email protected]")
    time.sleep(1)

    # 弹窗
    d.click_exists("imgs2/[email protected]")
コード例 #40
0
ファイル: test_dummy.py プロジェクト: danbao/AirtestX
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#coding: utf-8

import os
import time

import pytest
import atx


d = atx.connect(platform='dummy')

def setup_function(f):
    d.resolution = (1280, 720)

def test_setget_resolution():
    assert d.resolution == (720, 1280)

    d.resolution = None # None is also OK to set
    assert d.resolution is None

    d.resolution = (200, 400)
    assert d.resolution == (200, 400)

    with pytest.raises(TypeError):
        d.resolution = [1,3]
    with pytest.raises(TypeError):
        d.resolution = 720
    assert d.resolution == (200, 400)
コード例 #41
0
ファイル: appaddr.py プロジェクト: chenjiaweigit/autopython
# coding=utf8

import atx
d = atx.connect()


class appFunction():
    def youobj(self):
        d(resourceId="winretailsaler.net.winchannel.wincrm:id/brand_tab_name",
          text=u"乳品饮料").click()
        d(resourceId="winretailsaler.net.winchannel.wincrm:id/item_brand_bg"
          ).click()
        for i in range(3):
            d(resourceId="winretailsaler.net.winchannel.wincrm:id/btn_increase"
              ).click()
        d(resourceId="winretailsaler.net.winchannel.wincrm:id/btn_ok").click()
        d(resourceId="winretailsaler.net.winchannel.wincrm:id/btn_ok").click()
        d(resourceId="winretailsaler.net.winchannel.wincrm:id/coupons_titlt"
          ).click()
        # 选第一个优惠券
        d(resourceId="winretailsaler.net.winchannel.wincrm:id/mcoupon_select"
          ).click()

    def monry(self):
        mon = float(
            d(resourceId=
              "winretailsaler.net.winchannel.wincrm:id/sum_money_textview").
            text[1:10])
        return mon

    def monry1(self):
コード例 #42
0
ファイル: test_region.py プロジェクト: 917228145/AutomatorX
# coding: utf-8
#

import atx
from PIL import Image

d = atx.connect('127.0.0.1:26944')
d.resolution = (720, 1280)
d.screenshot('screen.png')
bg = None #Image.open('hm.png')
print d.match('folder.png', bg)
nd = d.region(atx.Bounds(12, 324, 646, 418))
print d._bounds
print nd.match('folder.png', bg)
コード例 #43
0
            'chromeOptions': {
                'androidDeviceSerial': self._d.serial,
                'androidPackage': package or app.package,
                'androidUseRunningApp': attach,
                'androidProcess': process or app.package,
                'androidActivity': activity or app.activity,
            }
        }

        try:
            dr = webdriver.Remote('http://localhost:%d' % self._port, capabilities)
        except URLError:
            self._launch_webdriver()
            dr = webdriver.Remote('http://localhost:%d' % self._port, capabilities)
        
        # always quit driver when done
        atexit.register(dr.quit)
        return dr

    def windows_kill(self):
        subprocess.call(['taskkill', '/F', '/IM', 'chromedriver.exe', '/T'])


if __name__ == '__main__':
    import atx
    d = atx.connect()
    driver = ChromeDriver(d).driver()
    elem = driver.find_element_by_link_text(u"登录")
    elem.click()
    driver.quit()
コード例 #44
0
ファイル: test11111.py プロジェクト: chenjiaweigit/autopython
# -*- coding: UTF-8 -*-

from Tkinter import *
from tkMessageBox import *
import urllib
import urllib2
import time
import json
import os, sys, string, socket
from array import *
import atx

reload(sys)
sys.setdefaultencoding('utf-8')
d = atx.connect("http://localhost:8100")


def startupapp():
    d.start_app('winretailsaler.net.winchannel.wincrm')
    # d.start_app('com.winchannel.winretailsaler')#生产包
    image = d.screenshot()  # 返回图片
    image.save("screen.png")
    time.sleep(10)
    # 如果不是新安装的启动没有问答框
    if "允许“惠下单”" in d.session.alert.text:
        d.session.alert.accept()
    else:
        pass
        time.sleep(3)
    if "允许“惠下单”" in d.session.alert.text:
        d.session.alert.accept()
コード例 #45
0
# -*- encoding: utf-8 -*-
#
# Created on: Mon Jan 08 16:40:04 2018


import os
import atx


d = atx.connect(os.getenv("SERIAL"))
コード例 #46
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import time

import pytest
import atx
from atx.ext import cloudtest

d = atx.connect(platform='dummy')


def setup_function(f):
    d.resolution = (1280, 720)


def test_setget_resolution():
    assert d.resolution == (720, 1280)

    d.resolution = None  # None is also OK to set
    assert d.resolution is None

    d.resolution = (200, 400)
    assert d.resolution == (200, 400)

    with pytest.raises(TypeError):
        d.resolution = [1, 3]
    with pytest.raises(TypeError):
        d.resolution = 720
    assert d.resolution == (200, 400)
コード例 #47
0
# -*- coding:utf-8 -*-
import atx
import sys
import wda
import time
from atx.ext.report import Report  # report lib
reload(sys)
sys.setdefaultencoding('utf8')
d = atx.connect('http://192.168.228.50:8100', platform='ios')
print d.status()
d.start_app('com.gao7.wallpaper.pid37ch03')
rp = Report(d, save_dir='report')

rp.patch_uiautomator()  # for android UI test record (optional)
#rp.info("Test started") # or rp.info("Test started", screenshot=d.screenshot())
#rp.error("Oh no.", screenshot=d.screenshot())
dis = d.display
m = dis.width * 0.5
n1 = dis.height * 0.75
n2 = dis.height * 0.25


#获得机器屏幕大小x,y
def getSize():
    x = dis.width
    y = dis.height
    return (x, y)


#屏幕向上滑动
def swipeUp(t):
コード例 #48
0
ファイル: testatx.py プロジェクト: ftyszyx/tools
# coding: utf-8
import atx

d = atx.connect() # 如果多个手机连接电脑,则需要填入对应的设备号
d.screenshot('screen.png') # 截图