My question is as follows: How can I locate the device model name, the reason is as follows. I am writing Java code for Appium, and would like to create a certain logic gate that deals with different model types that has test cases suited for each particular device's dimensions.
I tried reading different solutions, some involving Android figuring maybe they could offer some helpful pointers. However, this was not the case. System.getProperties().list(System.out); for example, which I hoped could provide me the solution needed, was not the answer either. Though I have expected as much.
I would use capabilities.getPlatform(); However, this is not valid since capabilities by default are null, and thus getPlatform() would simply return to me the name that I had to pass in manually. At this point, I am suspecting there may not be a way to do this in Java(?) I did find a code that was done in JavaScript, but it was for checking the type of phone that connected to the website (link: http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/)
Help is much appreciated. Below is my @BeforeTest method:
@BeforeTest
public void setUp() throws FileNotFoundException, IOException, IllegalMonitorStateException
{
//File app = new File("/Users/first.last/Library/Developer/Xcode/DerivedData/iPhone-aowtfpozolcnpigbxzxxxxkyiubq/Build/Products/Debug-iphonesimulator/TheWeather.app");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "iOS");
//8.4
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "8.4");
//Iphone 6-(storytelling)-igor
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Iphone 6-(storytelling)-name");
//capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability("bundleID", "com.weather.TWC");
//70cb6f4fd5e313b16742c083ccbc1897d82b094d
capabilities.setCapability("udid", "70cb6f4fd5e313b16742c083ccbc1897d82b094d");
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
driver = (IOSDriver) new Augmenter().augment(driver);
System.out.println(capabilities.getCapability(MobileCapabilityType.DEVICE_NAME));
logger.info("Environment: iOS 8.4 and iPhone 6 plus device");
}