Here you can see the below code snippet it will take a while loop and search for that element if its found it will be break loop, else it will swipe and will try to find that element. its working fine for me
if(!workFlowDataMap.get(“CUSTOMERNAME”).equalsIgnoreCase(“SKIP”)){
customerNames=workFlowDataMap.get(“CUSTOMERNAME”).split(",");
for(int i=0; i<customerNames.length; i++){
while(true)
{
if(findElement(customerNames[i]))
{
break;
}
else
{
mdriver.swipe(33, 1080, 767, 313, 1000);
}
}
MobileElement element=mdriver.findElement(By.name(customerNames[i]));
TouchAction action = new TouchAction(mdriver);
action.longPress(element).release().perform();
}
}