-
Notifications
You must be signed in to change notification settings - Fork 1
/
AppendDeviceTest.py
60 lines (52 loc) · 1.88 KB
/
AppendDeviceTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import time
import logging.config
from actuctic.start import Start
# 配置日志文件和级别
logging.config.fileConfig('log_config.ini')
try:
# 连接舵机后启动
app_start = Start()
app_start.start_ui()
app_main = app_start.app['一维弦电机界面']
except BaseException:
logging.error("AppendDiviceTest-----starting app was wrong!")
try:
# 点击添加设备按钮
app_main.添加设备.click()
app_main_appendDevice = app_start.app.window(title_re=".*添加设备*")
except BaseException:
logging.error("AppendDiviceTest-----can't click append button")
# baud_rate select
right_list = ['115200', '128000', '200000', '230400', '256000', '460800', '500000', '921600', '1000000', '1382400', '1500000', '2000000']
baud_rate = app_main_appendDevice.child_window(auto_id="ComboBox_Bitrate", control_type="ComboBox")
try:
# 修改baud_rate.text_block()为baud_rate.selected_text()
if baud_rate.texts() != right_list and baud_rate.text_block() != '115200':
raise print("波特率列表出错了")
for i in range(0, 12):
baud_rate.select(right_list[i])
time.sleep(2)
baud_rate.select('256000')
except BaseException:
logging.error("AppendDiviceTest-----baud rate list and default was wrong!")
try:
# adress input
address = app_main_appendDevice.Edit
address_text = ['20']
if address.text_block() != '':
raise print("The default of address is wrong!")
# address test
for i in address_text:
time.sleep(1)
address.set_text(i)
time.sleep(1)
app_main_appendDevice.Button2.click()
# time.sleep(3)
# if i != address_text[-1]:
# app_main_appendDevice.Dialog2.确定.click()
except BaseException:
logging.error("AppendDiviceTest-----address input test was wrong!")
# 关闭
app_main.关闭.click()
time.sleep(2)
app_main.关闭.Button.click()