Hi I’m using appium to find all the elements in screen and for doing that I’m getting all the elements which are child of /UIAApplication/UIAWindow
and then create a loop and get each elements tagName,name,location etc…
However when I do that , for each method I called(such as element.getAttribute(“name”) ) appium makes a http request(Than converts it to javascript to use it on Apple Instruments) and waits for response , so if I have 10 items in a screen it took almost 1 minute to investigate elements in a screen
You can see the code I’m using in below. My question here is , is there anyway to get all elements and related informations from appium once and don’t let appium to make web request for each method that I make on WebElement(such as element.getAttribute)
List<WebElement> elements = driver.findElementsByXPath("//UIAApplication[1]/UIAWindow[1]/*");
System.out.println("Elements Size:"+elements.size());
IOSScreenObjects result= new IOSScreenObjects();
List<MTOSElement> screenElements = new ArrayList<MTOSElement>();
String screenKey="";
for (int i=0;i<elements.size();i++) {
WebElement element = elements.get(i);
//System.out.println("Element Tag:"+element.getTagName());
//System.out.println("Element Name:"+element.getAttribute("name"));
//System.out.println("Element ID:"+((RemoteWebElement) element).getId());
//System.out.println("Location: "+element.getLocation());
String elementTagName = element.getTagName();
String elementLocation = element.getLocation().toString();
MTOSElement mtosElement = new MTOSElement(elementTagName,elementLocation,element);
screenElements.add(mtosElement);
screenKey = screenKey+elementTagName+","+elementLocation+",";
}
Thanks
Tolga