问题描述:
连接三个手机,在server代码中能获取到三个手机信息,这时执行server.main()启动三个appium,查看进程管理器,一开始也启动看到三个node进程,但过几秒就杀掉了2个node进程,剩下了一个。如果是连接2台手机是能正常显示2个node进程。另外如果手动开三个cmd启动三个appium,进程管理器能正常显示三个node进程的。老师怎么改改啊,我想跑个10台手机啊。
def create_command_list(self,i):
’’‘
生成命令
’’’
#appium -p 4700 -bp 4701 -U 127.0.0.1:21503
command_list = []
appium_port_list = self.create_port_list(4700)
bootstrap_port_list = self.create_port_list(4900)
systemPort_list = self.create_port_list(8200)
device_list = self.device_list
# for i in range(len(device_list)):
command = "appium -p "+str(appium_port_list[i])+" -bp "+str(bootstrap_port_list[i])+" -U "+device_list[i]+" --no-reset --session-override --log C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log"
#appium -p 4723 -bp 4726 -U 127.0.0.1:62001 --no-reset --session-override --log E:/Teacher/Imooc/AppiumPython/log/test01.log
command_list.append(command)
self.write_file.write_data(i,device_list[i],str(bootstrap_port_list[i]),str(appium_port_list[i]),str(systemPort_list[i]))
return command_list
def start_server(self,i):
’’‘
启动服务
’’'
self.start_list = self.create_command_list(i)
print(self.start_list)
self.dos.excute_cmd(self.start_list[0])
def kill_server(self):
server_list = self.dos.excute_cmd_result(‘tasklist | find “node.exe”’)
if len(server_list)>0:
self.dos.excute_cmd(‘taskkill -F -PID node.exe’)
def main(self):
thread_list = []
self.kill_server()
self.write_file.clear_data()
print(len(self.device_list))
for i in range(len(self.device_list)):
appium_start = threading.Thread(target=self.start_server,args=(i,))
thread_list.append(appium_start)
print(thread_list)
for j in thread_list:
j.start()
time.sleep(30)
if name == ‘main’:
server = Server()
print(server.main())
pycharm日志打印的内容:
C:\Users\Administrator\PycharmProjects\AppiumPython\venv\Scripts\python.exe C:/Users/Administrator/PycharmProjects/AppiumPython/util/server.py
3
[<Thread(Thread-1, initial)>]
[<Thread(Thread-1, initial)>, <Thread(Thread-2, initial)>]
[<Thread(Thread-1, initial)>, <Thread(Thread-2, initial)>, <Thread(Thread-3, initial)>]
[‘appium -p 4700 -bp 4900 -U 2197aa0d --no-reset --session-override --log C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log’]
[‘appium -p 4702 -bp 4902 -U cb78871 --no-reset --session-override --log C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log’]
[‘appium -p 4701 -bp 4901 -U TEV0217929002336 --no-reset --session-override --log C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log’]
[Appium] Welcome to Appium v1.15.1
[Appium] Non-default server args:
[Appium] port: 4702
[Appium] bootstrapPort: 4902
[Appium] sessionOverride: true
[Appium] logFile: C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log
[Appium] udid: cb78871
[Appium] noReset: true
[Appium] Deprecated server args:
[Appium] -U,–udid => --default-capabilities ‘{“udid”:“cb78871”}’
[Appium] --no-reset => --default-capabilities ‘{“noReset”:true}’
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] udid: cb78871
[Appium] noReset: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4702
uncaughtException: EPERM: operation not permitted, stat 'C:\Users\Administrator\PycharmProjects\AppiumPython\log\test02.log’
Error: EPERM: operation not permitted, stat ‘C:\Users\Administrator\PycharmProjects\AppiumPython\log\test02.log’
[Appium] Welcome to Appium v1.15.1
[Appium] Non-default server args:
[Appium] port: 4700
[Appium] bootstrapPort: 4900
[Appium] sessionOverride: true
[Appium] logFile: C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log
[Appium] udid: 2197aa0d
[Appium] noReset: true
[Appium] Deprecated server args:
[Appium] -U,–udid => --default-capabilities ‘{“udid”:“2197aa0d”}’
[Appium] --no-reset => --default-capabilities ‘{“noReset”:true}’
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] udid: 2197aa0d
[Appium] noReset: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4700
[Appium] Welcome to Appium v1.15.1
[Appium] Non-default server args:
[Appium] port: 4701
[Appium] bootstrapPort: 4901
[Appium] sessionOverride: true
[Appium] logFile: C:/Users/Administrator/PycharmProjects/AppiumPython/log/test02.log
[Appium] udid: TEV0217929002336
uncaughtException: EPERM: operation not permitted, stat 'C:\Users\Administrator\PycharmProjects\AppiumPython\log\test02.log’
Error: EPERM: operation not permitted, stat ‘C:\Users\Administrator\PycharmProjects\AppiumPython\log\test02.log’
[Appium] noReset: true
[Appium] Deprecated server args:
[Appium] -U,–udid => --default-capabilities ‘{“udid”:“TEV0217929002336”}’
[Appium] --no-reset => --default-capabilities ‘{“noReset”:true}’
[Appium] Default capabilities, which will be added to each request unless overridden by desired capabilities:
[Appium] udid: TEV0217929002336
[Appium] noReset: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4701
None