Not able to Tap on Element "Order" in Tap Bar

Appium Log-Attached

Code-

public class EHTest {

public static void main(String[] args) throws MalformedURLException {

DesiredCapabilities d = new DesiredCapabilities();

d.setCapability(MobileCapabilityType. DEVICE_NAME , “iPhone X”);

d.setCapability(MobileCapabilityType. PLATFORM_NAME , “IOS”);

d.setCapability(MobileCapabilityType. PLATFORM_VERSION , “12.4”);

d.setCapability(“autoGrantPermissions”, “true”);

d.setCapability(“autoAcceptAlerts”, “true”);

d.setCapability(MobileCapabilityType. AUTOMATION_NAME , AutomationName. IOS_XCUI_TEST );

d.setCapability(MobileCapabilityType. APP , “/Users/ankitdubey/Desktop/Eclipse/Espresso House.app”);

IOSDriver driver;

driver = new IOSDriver<>( new URL(“http://127.0.0.1:4723/wd/hub”), d);

driver.findElementByXPath("//*[@value=‘Enter mobile number’]").sendKeys(“46555277538”);

driver.findElementByName(“Register”).click();

driver.manage().timeouts().implicitlyWait(3000, TimeUnit. SECONDS );

driver.findElementByXPath("//*[@value=‘Enter code’]").sendKeys(“70428”);

driver.manage().timeouts().implicitlyWait(3000, TimeUnit. SECONDS );

driver.findElementByName(“Skip”).click();

driver.manage().timeouts().implicitlyWait(6000, TimeUnit. SECONDS );

driver.findElementsByClassName(“XCUIElementTypeButton”).get(0).click();

// driver.findElementByXPath("//XCUIElementTypeButton[@name=‘Order’]").click();

}

}

Eclipse -

Sep 15, 2019 4:24:39 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0

INFO: Detected dialect: W3C

Exception in thread “main” org.openqa.selenium.ElementNotVisibleException: The element ‘Button at {{328.0, 852.0}, {31.0, 30.0}}’ is not visible on the screen and thus is not interactable

Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:48’

System info: host: ‘Ankit-Dubey-2017-MBPro.local’, ip: ‘fe80:0:0:0:8e3:8c6c:51ac:d0ce%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.14.6’, java.version: ‘1.8.0_191’

Driver info: io.appium.java_client.ios.IOSDriver

Capabilities {app: /Users/ankitdubey/Desktop/E…, autoAcceptAlerts: true, autoGrantPermissions: true, automationName: XCuiTest, browserName: , databaseEnabled: false, deviceName: iPhone X, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, platform: MAC, platformName: iOS, platformVersion: 12.4, takesScreenshot: true, udid: C1F87E5A-C893-4CB7-9D65-444…, webStorageEnabled: false}

Session ID: 0afbd2bc-c753-444e-89b7-e9b50900324a

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)

appium-server-logs copy.txt (273.6 KB)

try using below code

driver.findElement(MobileBy.iOSNsPredicateString(" type == \“XCUIElementTypeButton\” AND name == \“Order\” ")).click();

@PramodKarande Thanks buddy .I solved it with below line-

	driver.findElementByAccessibilityId("Order").click();

but can you please help me with some sample code for Scrolling ?.I am stuck right now

Refer this for scrolling using UIScrollable Android class : http://www.automationtestinghub.com/appium-scroll-examples/

Or simply you can use press and move by co-ordinated function of touchAction

For iOS I have always used below code :
HashMap<String, String> scrollObject = new HashMap<>();
JavascriptExecutor js = (JavascriptExecutor) driver;
scrollObject.put(“direction”, “down”);
String text = “Make Payment”;
scrollObject.put(“predicateString”, “label == '” + text + “’”);
js.executeScript(“mobile: scroll”, scrollObject);