【问题标题】:Select from a dropdown in Android using Selenium and Appium使用 Selenium 和 Appium 从 Android 的下拉列表中选择
【发布时间】:2017-06-09 09:31:17
【问题描述】:

我在使用 Selenium 和 Appium 从 Android 上的性别下拉列表中选择时遇到问题,经过多次试验,我创建了这个屏幕截图:

如何从下拉列表中选择性别类型?

【问题讨论】:

标签: android selenium-webdriver drop-down-menu appium android-uiautomator


【解决方案1】:

使用 javascript 和 wd 作为我的驱动程序提供程序,我使用这样的东西:

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();

祝你好运!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-13
    • 1970-01-01
    • 1970-01-01
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多