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

Class WebBotMain

PyAibote/WebBot.py:23–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class WebBotMain(
24 ABC,
25 LoggerRecord,
26 ThreadingTCPServer,
27 UniversalFunction,
28 SendClientData,
29 WebLoadWait,
30 PagesNavigation,
31 ElementOperation,
32 KeymouseOperation,
33 PopUpWindow,
34 WindowOperation,
35 DrivingOperation,
36 JSinjection,
37 CookiesOperation,
38 ChatGenerative,
39 DataBaseHandle,
40 Sqlite3DataBaseHandle,
41 IframeOperation,
42 WebSocketServerUse
43 ):
44
45 def __init__(self,*args):
46 if len(args) ==1:
47 address_info = socket.getaddrinfo(None, args[0], socket.AF_INET, socket.SOCK_STREAM)[0]
48 family, socket_type, proto, _, socket_address = address_info
49 server = socket.socket(family, socket_type, proto)
50 server.bind(socket_address)
51 server.listen(1)
52 print("Mix Start WebBot Service")
53 self.request, self.client_address = server.accept()
54 print("WebBot Client link succeeded")
55 else:
56 super().__init__(*args)
57
58 @classmethod
59 def _build(self, listen_ip, listen_port: int, Debug: bool = True, driver_params: dict = {}) -> object:
60 """
61 混合开发时启动web驱动
62 TCP transit service.
63
64 listen_port: 脚本监听的端口
65 return: windows类对象
66
67 listen_port: the port on which the script listens.
68 Debug: Is the script deployed locally?
69 return: windows class object
70 """
71 if Debug:
72 default_params = {
73 "serverIp": "127.0.0.1",
74 "serverPort": listen_port,
75 "browserName": "chrome",
76 "debugPort": 0,
77 "userDataDir": f"./UserData{random.randint(100000, 999999)}",
78 "browserPath": None,
79 "argument": None,
80 }

Callers 1

_buildMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected