Not able to get the text by using the getAttribute function

I have to read the text from the androidElement but not able to do so by using the get attribute function.
Because there is no value present for the attribute Text, but for the content-desc its there. So i am trying to get the text by using
String text=driver.findelementByxpath(xpath).getattribute(“content-desc”);

Note:-This is the sample Syntax

Instead of getattribute can you try getAttribute? ‘Attribute’ - A caps

Hello boss thanks for your reply…But as i mentioned ,that is only sample one i am using the correct syntax .i think getAttribute with content-desc has some problem… Although we are writing the wrong syntax and if we will type ctrl+space it will suggest the correct one ,so the caps things will go away.so may be the problem with the getattribute with content-desc

I faced similar issue.
Try the folllwing

getAttribute(“name)” instead of content-desc.
It should work

Regards,
Akshaj.