'Select from a dropdown in Android using Selenium and Appium
Solution 1:[1]
With javascript and wd as my driver provider, I use something like this:
let cmbBoxId = driver.waitForElementById("gender", '', timeOut, pollFreq);
// note: Without the com.appzonegroup.dejavuandroid.zoneRevamp:id/
// Clicking the dropDown to open the listView
cmbBoxId.click();
let optionPath = "//android.widget.TextView[@resource-id='" +
"com.appzonegroup.dejavuandroid.zoneRevamp:id/spinner_item";
// You can choose to look for the option by index or text
// By Index of the desired option
// optionPath += " and @index='" + "1" + "'";
// **OR**
// By Text of the desired option
// optionPath += " and @text='" + "Female" + "'";
optionPath += "]";
//Clicking the desired option
driver.waitForElementByXPath(optionPath, '', timeOut, pollFreq).click();
Good luck!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |




