The attributes of an element are often used, and when positioned to an element, it is sometimes necessary to use the text value of the element, ClassName, Resource-id, checked, and so on.
The properties of the general standard can be obtained by get_attribute ("attribute name"), let's see how the following elements are obtained. From top to bottom.
Let's start with the text, we'll get to this element by XPath.
The Get text method is:
There are two methods, but generally the first one, because the writing is relatively simple. It would be nice to know that there is a second way.
Get Resource-id Value method:
Get ClassName Value Method:
Get Content-desc Value method:
In particular, when the value of the Content-desc is empty, this method gets the value of the element text and returns the corresponding value only if Content-desc is not empty.
Get the Check value method:
Element as long as the attribute value is Boolean, that is, false or true. Can be obtained by this method, it is not listed. Here the second method is often used, the focus of mastery!!
Get the element coordinates:
Basically, when you navigate to an element, the attributes in the element are available.
Python+appium Get app Element property values