Native Android mobile app test automaton navigation with multiple class elements
<p><a href="https://i.stack.imgur.com/Jbt8l.png" rel="nofollow"><img src="https://i.stack.imgur.com/Jbt8l.png" alt="enter image description here"></a></p>

<p>How do you enter text (password), when there is no <code>text</code>, <code>resource-id</code>, <code>content-desc</code> and there is more than one class? i.e. the class name for the <code>username</code> is also <code>android.widget.EditText</code>. I've tried xpath or UISelector as follows, yet it doesn't work:</p>

<pre><code>driver.find_element_by_xpath("//android.widget.EditText[@text='']").send_keys("xxxx")

driver.find_element_by_android_uiautomator("new UiSelector().text('')")
</code></pre>

<p>Did you try looking by a class name? You can try the following:</p>

<pre><code>element = driver.find_element_by_class_name('android.widget.EditText')
</code></pre>

<p>If you have more than one element with similar class, find all of them:</p>

<pre><code>elements = driver.find_elements_by_class_name('android.widget.EditText')
</code></pre>

<p>And then you have 2 options.:</p>

<ol>
<li><p>You can iterate over the located elements and check if you can get some meaningful text from each one of them by calling <code>element.text</code>. This is as an attempt to find which element might return something related to password.</p></li>
<li><p>If there is no way to reliably identify which one of the elements is the one you need you will have to just select a predefined element from the list. For example: <code>passField = elements[0]</code>.</p></li>
</ol>

android python automation appium uiautomator