1

If I go back to previous screen, Appium XCUItest can't click on app's menu on my IOS device. I tried driver.tap and it didn't work. I see the menu button flashing but it never opens when the click is processed. Can anyone advise on how to fix this? Thanks.
For some reason if I clicked the menuelement twice then it opens the menu and it passes. The upper part of the test which the code is not shown here only required one menu click to open the menu. But I noticed subsequent menu clicks requires two clicks. Strange huh?

        driver.findElementByAccessibilityId("Back").click();
        Thread.sleep(5000);
        String menu = "icon hamburger";
        WebElement menuelement = driver.findElementByAccessibilityId(menu);
        menuelement.click();

also tried

 driver.findElementByAccessibilityId("Back").click();
 Thread.sleep(5000);
 String menu = "icon hamburger";             
 wait.until(ExpectedConditions.presenceOfElementLocated(By.id(menu)));
 driver.findElement(By.id(menu)).click();
1

Try to find the hamburger menu using the annotation @iOSXCUITFindBy and set the wait.until(ExpectedConditions.elementToBeClickable(By.id("testID"))).click();.

This expectation will help determine if the problem is with the locator.

Your code should be like this:

@iOSXCUITFindBy(accessibility = "icon hamburger")
private MobileElement menuBtn;

driver.findElementByAccessibilityId("Back").click();
Thread.sleep(5000);
wait.until(ExpectedConditions.elementToBeClickable(By.id("icon hamburger"))).click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.