I am building a test automation system on iOS and I am having issues when trying to click on element which is : XCUIElementTypeStaticText.
Info about my system:
using Appium desktop 1.17.1
iOS 13.6.1
iphone 7
code in Java
framework cucumber and testNG
Here is my xpath for the element I want to click on:
/XCUIElementTypeStaticText[@name=“Continue with Email”]
There is also an accessibility id = Continue with Email
I cannot manage to click on this button.
So far what I tried and did not work:
using javascript executor --> not working, impossible to click
using the xpath —> not working, I cannot click
using this solution that I found on the appium forum:
MobileElement mobileElement = (MobileElement) platform.getIosDriver().findElement(MobileBy.iOSNsPredicateString(“type == ‘XCUIElementTypeStaticText’ AND name == '” + “Continue with Email” + “’ AND visible == 1”))
mobileElement.click();
When I am running:
System.out.println(platform.getIosDriver().getPageSource()); for all the page here is the result I am getting from this part of the app…This element is inside a Button element which has no accessiblity id.
Is it possible to have some advice or help?
If this element type (XCUIElementTypeStaticText ) cant be clicked I can ask the developers to put an accessibility id for the button.
hi!
Thanks for answering.
So far no I have not fixed it…I tried touch action, I tried tap…I tried a lot of things so far :-)>
I am wondering If I should not just ask the developers to put an accessibility id into the Button Element…if they put an accessibility id in the Button then I could be able to interact with it:
Attached is one of the screenshot for appium inspector ( and visible = false).
thanks!
I already tried to apply some of the solution described in the case but it did not work.
What do you mean by a compatibility between XCode and iOS OS? I am not using XCode…I just used it to install WebDriverAgent on the phone.
Is it the issue? I am new to iOS automation so maybe I am missing some things here.
When i faced a similar issue related to perform click action my issue was fixed using latest versions of Xcode to install WDA and iOS OS. In ur case iOS 13.6.1is latest OS so i adviced you to use latest version of Xcode as well.
If nothing works ask dev to make visible property to true and give a try once.
Make sure that clickable area of the button is overlapping the element. I find that sometimes I need to center click elements to get them to proc the trigger.
def tap_center_element(ele)
position = ele.get_position
center_x = position[:end_x] / 2
center_y = position[:end_y] / 2
Appium::TouchAction.new($driver).tap(x: center_x, y: center_y).perform
end