Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. package com.qa.Test;
  2.  
  3. import java.io.IOException;
  4.  
  5. public class AppiumStart {
  6.  
  7. public void startServer() {
  8. Runtime runtime = Runtime.getRuntime();
  9. try {
  10. runtime.exec("cmd.exe /c start cmd.exe /k \"appium -a 127.0.0.1 -p 4723\"");
  11. Thread.sleep(8000);
  12. } catch (IOException | InterruptedException e) {
  13. e.printStackTrace();
  14. }
  15. }
  16.  
  17. public void stopServer() {
  18. Runtime runtime = Runtime.getRuntime();
  19. try {
  20. runtime.exec("taskkill /F /IM node.exe");
  21. runtime.exec("taskkill /F /IM cmd.exe");
  22. } catch (IOException e) {
  23. e.printStackTrace();
  24. }
  25. }
  26.  
  27. public static void main(String[] args) throws InterruptedException {
  28. AppiumStart appiumServer = new AppiumStart();
  29. appiumServer.startServer();
  30. Thread.sleep(5000);
  31. System.out.println("appium Server Started");
  32. appiumServer.stopServer();
  33. System.out.println("appium Server Stopped");
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement