Я пытаюсь автоматизировать вызов сервера Appium с использованием Java-кода, но я не вижу никаких действий - PullRequest
0 голосов
/ 20 июня 2019
Code is not giving any action

I have tried the following and it had some SLF4J issue which is resolved but no action of server invoking

package AppiumTests.AppiumTests;

import java.io.File;
import java.io.FileNotFoundException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

//import AppiumMavenProject.AppiumMavenProject.Base;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;

public class AppiumServerStarting {

    //path of node
    static String NodePath = "C:\\Program Files\\nodejs\\node.exe";
  //path of MAIN JS APPIUM      

static String AppiumMainJS_path = "C: \ Users \ LITTIN JOMON \ AppData \ Roaming \ npm \ node_modules \ appium \ build \ lib \ main.js";статический сервис AppiumDriverLocalService;статический SimpleDateFormat df = new SimpleDateFormat ("гггг-дд ЧЧ: мм: сс");

    @BeforeTest
    public void startserver()
    {
        service =AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
                .usingDriverExecutable(new File(NodePath))
                 .withAppiumJS(new File(AppiumMainJS_path))
                 .withIPAddress("127.0.0.1")
                 .usingPort(4728));
//               .withLogFile(new File("")));
                System.out.println("Starting the appium serever..."+"\n"+df.format(new Date()) + "\n------------");
    }
    @Test
    public void testServer() throws FileNotFoundException
    {
        System.err.println("The Url is :"+ service.getUrl().toString());
        System.err.println("Is server Running :" + service.isRunning());
    }
    @AfterTest
    public void stopserver() throws InterruptedException
    {
        if (service.isRunning()==true)
        {
            service.stop();
            System.out.println("\n-----------------------------"
                    + ""+"\nStopping the Appium Server..."+"\n"+df.format(new Date()));
        }
    }

}
...