Unable to get value of attribute for a MobileElement on IOS

Hi,

I have a simple static text in an IOS app and I am trying to read any of its attributes, however it does not work.
Element:

I can find the object, I cast it to MobileElement, but when I am trying to read an attribute, I get nothing.

System.out.println(myelement.getAttribute(“value”));
OR
System.out.println(myelement.getAttribute(“name”));

Any ideas?

1 Like

stumbling on this, what happened

Did you find the solution?

is is all depending what element it is.

Example:

  • with UILabel you can’t get anything until in iOS code you will add accessibilityValue to this element. (this is known issue of iOS for a long time)

give us example of your problem element.

Hi Aleksei,

I’m having a similar problem.

I try to get the Attribute “enabled” but I get an error like:

org.openqa.selenium.UnsupportedCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported By the mapped resource....

But when I look at my xml, I can see this:

<UIAButton dom="" enabled="true" height="44" hint="" label="" name="" path="/0/0/2/2" valid="" visible="true" width="384" x="15" y="354.875"></UIAButton>

So it is there…

Is this accessibilityValue the solution to this? And do you know where I can find how to solve this?
The development team will want to know.

Kind regards and thanks in advance!

Jonas

nothing will help you now accept when iOS dev will set value for UIButton for other working attributes like “name” or “value”

Aleksei,

I tried an object where accessibilityLabel was filled in, this was showed as all values were filled in (accessibilityValue, accessibilityName, accessibilityLabel) but still it didn’t work.
Is it only working if the accessibilityValue or accessibilityName are filled in?

Thanks in advance!

Kind regards

when you put accessibilityValue to object in iOS -> with Appium you will see this as “value” attribute.

valid for UILAbel at least. with UIButton hope should be same.