Reputation: 2296
I have been having issues to select from a gender dropdown on Android using Selenium and Appium, after several trials, I created this screenshot:
How do I select a gender type from the dropdown?
Upvotes: 0
Views: 4029
Reputation: 141
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!
Upvotes: 1