Ejemplo n.º 1
0
 def test_press_release(self):
     left, top = self.__get_pos(50)
     left1, top1 = self.__get_pos(20)
     mouse.press(coords=(left, top))
     mouse.release(coords=(left1, top1))
     data = self.__get_text()
     self.assertEqual(str(top) in data, str(top1) in data)
     self.assertEqual(str(left) in data, str(left1) in data)
Ejemplo n.º 2
0
 def test_press_release(self):
     left, top = self.__get_pos(50)
     left1, top1 = self.__get_pos(20)
     mouse.press(coords=(left, top))
     mouse.release(coords=(left1, top1))
     data = self.__get_text()
     self.assertEqual(str(top) in data, str(top1) in data)
     self.assertEqual(str(left) in data, str(left1) in data)
Ejemplo n.º 3
0
 def selectionModel(self):
     """
     在Aerobook--Aerocheck的图形区通过键盘和鼠标的操作方式选中全部的结构单元
     选择结构单元
     """
     self.k.press_key(self.k.shift_key)  # 按下键盘上的shift键
     mouse.press(coords=(345, 167))  # 鼠标长按
     mouse.release(coords=(1488, 727))  # 释放鼠标位置
     self.k.release_key(self.k.shift_key)  # 释放键盘上的shift键
Ejemplo n.º 4
0
def add_TCP_Signal(window_name):
    ms.press(button='left', coords=(902, 456))
    ms.move(coords=(940, 456))
    ms.release(button='left', coords=(940, 456))
    app._wait_child(window_name, u'编辑__信号__signal', 'ready', 10, 2)
    app.click(window_name, 'ComboBox5')
    time.sleep(1)
    app.input(window_name, 'ComboBox5', 'i_block')  #添加数据结构
    app.click(window_name, u'确定')   #确定
    app._wait_not_child(window_name, u'编辑__信号__signal', 'ready', 10, 2)
Ejemplo n.º 5
0
def add_TCP_Signal(window_name):
    ms.press(button='left', coords=(902, 456))
    ms.move(coords=(940, 456))
    ms.release(button='left', coords=(940, 456))
    app._wait_child(window_name, u'信号编辑对话框', 'ready', 10, 2)
    app.click(window_name, 'ComboBox5')
    app.input(window_name, 'ComboBox5', 'i_block')#添加数据结构
    app.Sendk('ENTER', 1)
    app.click(window_name, u'确定')#确定
    app._wait_not_child(window_name, u'信号编辑对话框', 'ready', 10, 2)
Ejemplo n.º 6
0
    def click(self, pos, duration=0.05, button='left'):
        if button not in ("left", "right", "middle"):
            raise ValueError("Unknow button: " + button)

        pos = list(pos)
        pos[0] = pos[0] + self.monitor["left"]
        pos[1] = pos[1] + self.monitor["top"]
        mouse.press(button=button, coords=pos)
        time.sleep(duration)
        mouse.release(button=button, coords=pos)
Ejemplo n.º 7
0
    def click(self, pos, duration=0.05, button='left'):
        set_foreground_window(self.window)
        if button not in ("left", "right", "middle"):
            raise ValueError("Unknow button: " + button)

        pos = list(pos)
        pos[0] = pos[0] + self.monitor["left"]
        pos[1] = pos[1] + self.monitor["top"]
        pos = tuple(pos)
        coords = get_action_pos(self.window, pos)
        mouse.press(button=button, coords=coords)
        time.sleep(duration)
        mouse.release(button=button, coords=coords)
def Connction():
    app = application.Application(backend='uia').start(
        'C:\Program Files (x86)\Gateway\SSLVPN\gwclient.exe')
    # app = application.Application().start('C:\Program Files (x86)\Gateway\SSLVPN\gwclient.exe')
    wind_1 = app.actions
    send_keys("{VK_RETURN}")
    time.sleep(10)
    mouse.press(button='left', coords=(940, 450))  # 账号
    send_keys("J0009")
    time.sleep(10)
    mouse.press(button='left', coords=(940, 500))  # 密码
    send_keys("12345678")
    time.sleep(2)
    send_keys("{VK_RETURN}")
Ejemplo n.º 9
0
def add_TCP_Case(window_name):
    app.click(window_name, u'测试用例')
    app._wait_child(window_name, u'测试用例集', 'ready', 10, 2)
    app.right_click(window_name, 'TreeView2')
    app.Sendk('DOWN', 2)
    app.Sendk('ENTER',1)
    app._wait_child(window_name, u'新建用例分类', 'ready', 10, 2)
    app.click(window_name, u'确定')
#     app._wait_not_child(window_name, u'新建用例分类', 'ready', 10, 2)
    app._wait_child(window_name, u'用例分类', 'ready', 10, 2)
    app.right_click(window_name,u'用例分类') #测试用例root
    time.sleep(1)
    app.Sendk('DOWN',4)
    app.Sendk('ENTER',1)
    app._wait_child(window_name, u'新建测试用例', 'ready', 10, 2)
    app.Sendk('TAB',2)
    app.input(window_name, 'Edit1', 'content2')#输入用例名
    app.click(window_name,u'确定') #确定
    app.click(window_name,u'用例分类')
    app.Sendk('RIGHT',1)
    app.Sendk('DOWN',1)
    app._wait_child(window_name, 'content2', 'ready', 10, 2)
    

#添加信号
    app.click(window_name, u'测试用例变量')
    app.click(window_name, 'Button16')
    app._wait_child(window_name, u'选择信号对话框', 'ready', 10, 2)
    ms.click(coords=(610,470))#复选信号
    app.click(window_name, 'Button14')#确定
    app._wait_child(window_name, u'signal', 'ready', 10, 2)


#测试用例编辑    
    app.click(window_name, u'测试用例编辑')
    app.right_click(window_name, 'TreeItem16')
    app.Sendk('UP', 1)
    app.Sendk('ENTER', 1)#快速生成
    app._wait_child(window_name, u'删除', 'ready', 10, 2)
    ms.press(button='left',coords=(600,229))
    ms.move(coords=(661, 646))
    ms.release(button='left', coords=(661, 646))
    app.click(window_name, u'确定')
    app._wait_child(window_name, u'发送[signal]', 'ready', 10, 2)
Ejemplo n.º 10
0
def add_TCP_Signal(window_name):
    app.click(window_name, 'Pane2')
    x=py.position()[0]
    y=py.position()[1]
    x_left=x-174
    y_left=y-13
    x_right=x-135
    y_right=y-13
#     ms.press(button='left', coords=(902, 456))
#     ms.move(coords=(940, 456))
#     ms.release(button='left', coords=(940, 456))
    ms.press(button='left', coords=(x_left,y_left))
    ms.move(coords=(x_right,y_right))
    ms.release(button='left', coords=(x_right,y_right))
    app._wait_child(window_name, u'编辑__信号__signal', 'ready', 10, 2)
    app.click(window_name, 'ComboBox5')
    time.sleep(1)
    app.input(window_name, 'ComboBox5', 'i_block')  #添加数据结构
    app.click(window_name, u'确定')   #确定
    app._wait_not_child(window_name, u'编辑__信号__signal', 'ready', 10, 2)
# app.Sendk('ENTER')
# app.click(window_name,'ComboBox1')
# app.Sendk('UP')
# app.Sendk('ENTER')  #快速生成类型选择循环发送/接收信号
# 
# app.click(window_name,'Edit1')
# app.input(window_name,'Edit1','^A')
# app.input(window_name,'Edit1','50')  #设置循环次数

app.click(window_name,'TCP/IP')
print py.position()
x1=py.position()[0]
y1=py.position()[1]
checkbox_x=x1
checkbox_y=y1+388
ms.press(button='left', coords=(x1, y1))
py.moveTo(checkbox_x, checkbox_y)
ms.release(button='left', coords=(checkbox_x, checkbox_y)) 
app.click(window_name,u'确 定')


# #编辑测试用例—-新建动作
# app.Sendk('DOWN')
# app.Sendk('RIGHT')
# for i in range(8):
#     app.Sendk('DOWN')
# app.Sendk('ENTER')
# app.click(window_name,u'确 定') #新建动作—循环
# app.Sendk('DOWN')

Ejemplo n.º 12
0
import time
#1-鼠标移动-move方法----move()
# for i in range(10):
#     x=10*i
#     y=10*i
#     time.sleep(0.5)
#     #移动鼠标
#     mouse.move(coords=(x,y))

#2-鼠标点击-click方法--button指定左击还是右击,coords指定鼠标点击的位置
#单击-指定位置,鼠标左击
# mouse.click(button='left',coords=(40,40))
#单击-指定位置,鼠标右击
mouse.click(button='right', coords=(40, 40))
#双击
mouse.double_click(button='left', coords=(40, 40))

#3-鼠标的按下与释放
#按下鼠标:press,将鼠标移动到(140,40)坐标处按下
mouse.press(button='left', coords=(140, 40))

#释放鼠标:repleace,将鼠标移动到(300,40)坐标处释放
mouse.release(button='left', coords=(300, 40))

#4-右键单击指定坐标
mouse.right_click(coords=(400, 400))
#5-鼠标中键单击指定坐标
mouse.wheel_click(coords=(400, 400))
#6-滚动鼠标
mouse.scroll(coords=(1200, 300), wheel_dist=-3)
Ejemplo n.º 13
0
win32gui.EnumWindows(get_all_hwnd, 0)

for h, t in hwnd_title.items():
    if t is not "":
        print(h, t)



import requests
while True:
    try:
        now_time = (datetime.datetime.now()).strftime('%Y-%m-%d %H:%M:%S')
        response = requests.get('http://192.168.4.215:9090/')
        print('执行时间:{},网络连接正常,无需重连!'.format(now_time))
        time.sleep(60)
    except:
        # 方式一:创建应用程序时可以,指定应用程序的合适的backend,start方法中指定启动的应用程序
        app = application.Application(backend='uia').start('C:\Program Files (x86)\Gateway\SSLVPN\gwclient.exe')
        # app = application.Application().start('C:\Program Files (x86)\Gateway\SSLVPN\gwclient.exe')
        wind_1 = app.actions
        time.sleep(3)
        send_keys("{VK_RETURN}")
        time.sleep(15)
        mouse.press(button='left', coords=(940, 450)) #账号
        send_keys("J0009")
        time.sleep(5)
        mouse.press(button='left', coords=(940, 500)) #密码
        send_keys("12345678")
        time.sleep(2)
        send_keys("{VK_RETURN}")