How to get value content desc?

Hey All, Can you help me, i can’t get value from attribute content desc.

1 Like

Do you have the following statements above the statement that you show us? I was thinking you cannot get the text because the text is not present on the screen, so wait until the text is present, then verify it is present and then get it.

android - How can I wait for Mobile element - Stack Overflow

[Mobile] Verify Element Visible | Katalon Docs

3 Likes

I want to get value not to be verified, but to be retrieved and compared with other data.

1 Like

Did you try get text method if it’s static value ( [Mobile] Get Text | Katalon Docs).

1 Like

I’ve used the ‘get text’ code to get the content, but the ‘content-desc’ type doesn’t want to be picked up.
Hellppp Me…

1 Like

@pariz.pariz Is it grabbing a different value than you expect or is it just an empty string? Also have you checked that the object you are looking for does actually have the content-desc you are expecting by using the mobile object spy?

1 Like

just an empty string Bro… I don’t know what this result only empty string…


that’s my Result :

1 Like

can you use code in stackoverflow? that’s code appium, how to implements code in katalon?

1 Like

It doesn’t matter which web site you are getting your reference from. Just search for Selenium wait for statements, such as:

java - How to make Selenium wait until an element is present? - Stack Overflow

2 Likes

what I need is value content-desc bro, and I’ve tried and added a “wait element” to the that’s object bro.

1 Like

and the result is the same i.e. ‘empty string’

1 Like

@pariz.pariz How are you detecting the object that you are looking for to get the content-desc? If the identifier is not unique or the view is slightly different while you are using xpath to find a relative object then you may be capturing a different object that does not have a content-desc.

1 Like

Can you try either of these?
getAttribute using ‘name’ or ‘contentDescription’, instead of ‘content-desc’

1 Like

I just noticed that you don’t have any of the items selected in the “Detect object by” column within the image.

Hopefully, you have something selected that allows the item to be found within the application.

1 Like

If anyone still in the nerve of this problem, you can change content-desc to contentDescription. it solve mine.

Mobile.getAttribute(yourObjectElement, ‘contentDescription’, 5, FailureHandling.OPTIONAL)

here object listed by katalon while I running some test case especially that have class Android.view.View :
[checkable, checked,
{class,className}, clickable,
{content-desc,contentDescription},
enabled, focusable, focused,
{long-clickable,longClickable},
package, password,
{resource-id,resourceId},
scrollable, selection-start,
selection-end, selected, {text,name},
hint, extras, bounds, displayed,
contentSize]

1 Like