zoukankan      html  css  js  c++  java
  • appmw

    # coding:utf-8
    
    from appiumServer import AppiumServer
    from stfConnect import stfConnect
    from adbCom import adbCommand
    import time,os
    
    def startAppium(connName,taskTempDir):
        s=AppiumServer(connName,taskTempDir)
        appiumUrl,errorMsg = s.start_appium() 
        port = s.get_port()
        return appiumUrl,errorMsg ,port
        
    def shutDownAppium(port):
        #print "start..."
        process = os.popen("netstat -aon |findstr %d" % port).read()
        pid = process.replace('  ','').split(" ")[2]
        print(pid)
        m = os.popen("taskkill -f -pid %s" % pid)
        print(m.read())
        
    def getandroidVersion(devicename):
        adbconn = adbCommand(devicename,devicename)
        return adbconn.getAndroidVersion()
        
    def stfDeviceConnect(ip,port,stfToken,devicename):    
        s = stfConnect(ip,port,stfToken,devicename)
        s.deleteDevice()
        time.sleep(0.5)
        s.addDevice()
        time.sleep(0.5)
        #print s.connectName
        stfConn = s.getAdbConnectName()
        print stfConn
        adbConn = adbCommand(connName=stfConn,devicename=devicename)
        result = adbConn.connect_Terminate()
        termVersion = adbConn.getAndroidVersion()
        print termVersion
        return stfConn,termVersion,result
    
    def stfDeviceDisConnect(ip,port,stfToken,devicename):
        s = stfConnect(ip,port,stfToken,devicename)
        s.deleteDevice()    
        
    def touch(devicename,dx, dy):
        """
        usage: touch(500, 500)
        """
        os.popen("adb -s "+devicename+" shell input tap " + str(dx) + " " + str(dy))
        time.sleep(0.5)
        
    def SetAppiumIme(connName):
        os.system('adb -s '+connName+' shell ime set io.appium.android.ime/.UnicodeIME')
        #print('SetUnicodeIME')
        
    def SetSougouIme(connName):
        os.system('adb  -s '+connName+' shell ime set com.sohu.inputmethod.sogou/.SogouIME')
        #print('SetSogouIME')
  • 相关阅读:
    IP的幻觉
    糟糕的一天
    windows下批量生成文件
    基于Bandersnatch搭建本地pypi源
    vmware vsphere 无法启动故障;
    关于Centos7客户端代理配置
    怎样在交换机判断是否出现环路了呢?
    小小的网络故障
    express for LINUX
    ESXI 7.0 ovf 导出;
  • 原文地址:https://www.cnblogs.com/liuyun66535309/p/9190932.html
Copyright © 2011-2022 走看看