请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

三台手机启动三个Appium,进程管理器中发现会自己杀node进程

问题描述:
连接三个手机,在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

图片描述

正在回答 回答被采纳积分+3

1回答

Mushishi 2020-03-17 13:55:58

进程里面加一个.json。for里面,去监控进程其他执行完了才关闭

1 回复 有任何疑惑可以回复我~
  • 提问者 慕盖茨3546819 #1
    老师,可以说详细吗,一下子听不懂诶
    回复 有任何疑惑可以回复我~ 2020-03-17 23:00:50
  • Mushishi 回复 提问者 慕盖茨3546819 #2
    https://www.cnblogs.com/kujiawei/p/10601823.html   这个你可以仔细看一下 。
    回复 有任何疑惑可以回复我~ 2020-03-17 23:37:57
  • 提问者 慕盖茨3546819 回复 Mushishi #3
    进程里面加个.json是干嘛用的
    回复 有任何疑惑可以回复我~ 2020-03-18 12:20:52
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信