Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.qa.Test;
- import java.io.IOException;
- public class AppiumStart {
- public void startServer() {
- Runtime runtime = Runtime.getRuntime();
- try {
- runtime.exec("cmd.exe /c start cmd.exe /k \"appium -a 127.0.0.1 -p 4723\"");
- Thread.sleep(8000);
- } catch (IOException | InterruptedException e) {
- e.printStackTrace();
- }
- }
- public void stopServer() {
- Runtime runtime = Runtime.getRuntime();
- try {
- runtime.exec("taskkill /F /IM node.exe");
- runtime.exec("taskkill /F /IM cmd.exe");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static void main(String[] args) throws InterruptedException {
- AppiumStart appiumServer = new AppiumStart();
- appiumServer.startServer();
- Thread.sleep(5000);
- System.out.println("appium Server Started");
- appiumServer.stopServer();
- System.out.println("appium Server Stopped");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement