
com.appium.device.Devices Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AppiumTestDistribution Show documentation
Show all versions of AppiumTestDistribution Show documentation
A tool run Android and iOS test in parallel across devices
package com.appium.device;
import com.appium.manager.AppiumServerManager;
import com.appium.utils.Api;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
public class Devices {
private static List instance;
private Devices() {
}
@SneakyThrows
public static List getConnectedDevices() {
if (instance == null) {
System.out.println(Thread.currentThread().getId());
AppiumServerManager appiumServerManager = new AppiumServerManager();
String remoteWDHubIP = appiumServerManager.getRemoteWDHubIP();
URL url = new URL(remoteWDHubIP);
String response = new Api().getResponse(url.getProtocol()
+ "://" + url.getHost() + ":" + url.getPort() + "/device-farm/api/device");
instance = Arrays.asList(new ObjectMapper().readValue(response, Device[].class));
}
return instance;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy