MCPcopy Create free account
hub / github.com/a943512/PyAibote / CustomWinScript

Class CustomWinScript

test_windows.py:10–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8# 2. 自定义一个脚本类,继承 WinBotMain
9# 2. Customize a script class and inherit WinBotMain.
10class CustomWinScript(WinBotMain):
11
12 # 2.1. 设置是否终端打印输出 DEBUG :输出, INFO :不输出, 默认打印输出
13 # 2.1. Set whether the terminal prints output DEBUG: output, INFO: no output, and print output by default.
14 Log_Level = "DEBUG"
15 Websocket_Log_Level = "DEBUG"
16
17 # 2.2. 终端打印信息是否存储LOG文件 True: 储存, False:不存储
18 # 2.2. Does the terminal print information store the LOG file? True: yes, False: no.
19 Log_Storage = True
20
21
22 # 2.3. 注意:script_main 此方法是脚本执行入口必须存在此方法
23 # 2.3. Note: script_main This method must exist in the script execution portal.
24 def script_main(self):
25
26 # 查询所有窗口句柄
27 result = self.find_windows()
28 print(result)
29
30
31
32
33
34 # 主函数死循环时win驱动连接断开异常捕获跳出死循环demo示例代码
35 # while True:
36 # try:
37 # # 死循环中必须加入aibote函数代码
38 # result = self.find_windows()
39 # print("我是个死循环")
40 # time.sleep(2)
41
42 # # 服务端捕获客户端断开异常跳出线程循环结束连接
43 # except OSError as e:
44 # break
45
46 # # 捕获其他非连接断开异常
47 # except Exception as e:
48 # print(e)
49
50
51
52 # 关闭驱动 方法一 终端命令杀死驱动
53 # self.close_driver_local()
54
55 # 关闭驱动 方法二 驱动自动断开连接
56 # self.close_driver()
57
58 # 关闭驱动 方法三 终端命令杀死驱动
59 # os.popen('taskkill /f /t /im "WindowsDriver.exe"')
60
61 # 关闭驱动 方法四 cmd终端直接输入杀死驱动
62 # taskkill /f /t /im "WindowsDriver.exe"
63
64
65

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected