天天看點

python UIautomation自動化測試

iometer Windows 硬碟自動化UI測試代碼(基于UIautomation+python)

import subprocess

import uiautomation as auto

import pyautogui

import os

import time

from test import testworker

from test import testlist

from test import sysname

from test import Iometerpath

IometerReport = time.strftime(’%Y%m%d%H%M’, time.localtime())

def testcontrol():

def test():

i = 0

while i < len(testlist):

print(“第%s次測試” % (i+1))

test = testlist.copy()

work1test = [test[i]]

print(“worker1第%s次測試盤符是%s” % (i + 1, work1test))

test.remove(test[i])

work2test = test

print(“worker2第%s次測試盤符是%s” % (i + 1, test))

auto.TabItemControl(Name=“Disk Targets”).Click()

# 給work1配置設定硬盤
        auto.TreeItemControl(Name="Worker 1").Click(waitTime=1)
        auto.TreeItemContr