首先说明,本人用的exe方式安装的appium。

新建一个.vbs文件,写入以下脚本,记得把D盘换成你自己的盘符。

1.后面taskkill好像没有实际作用。。加就加了吧。

Set ws = CreateObject("Wscript.Shell")
ws.run "D:\\Appium\\node_modules\\.bin\\appium.cmd && cmd /c start taskkill /im cmd.exe /f",vbhide

 

2.appium.cmd文件也可以换成同目录下appium文件。

Set ws = CreateObject("Wscript.Shell")
ws.run "D:\\Appium\\node_modules\\.bin\\appium && cmd /c start taskkill /im cmd.exe /f",vbhide

 

3.也可以用appium自带的node.exe运行main.js文件启动,后面可以加上一些初始属性。

Set ws = CreateObject("Wscript.Shell")
ws.run "D:\Appium\node.exe D:\Appium\node_modules\appium\lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 18 --automation-name Appium --log-no-color",vbhide

 

 

当然你启动前最好检查下端口有没有被占用,如下代码

1 def kill_process(self):
2     u'''杀死占用5037端口的进程\n
3     '''          
4     try: 
5         pid = os.popen("netstat -ano | findstr 5037 | findstr  LISTENING").read().split()[-1]
6         os.system("taskkill /F /PID %s" %pid)
7     except IndexError as e:
8         print '端口没有被占用'

 

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2021-11-13
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2021-06-17
猜你喜欢
  • 2021-08-04
  • 2021-10-16
  • 2021-08-29
  • 2021-05-08
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案