如何在下拉列表中执行滚动到隐藏元素?

Emn*_*mna 6 selenium ui-automation appium protractor appium-ios

如何使用selenium,appium在该格式的下拉列表中执行滚动?我正在使用标签名来标识元素,<md-option .../>是下拉列表中的项目. 在此输入图像描述

这是我的HTML代码:

在此输入图像描述

Emn*_*mna 5

我通过这种方式解决了它:

// Create instance of Javascript executor
JavascriptExecutor je = (JavascriptExecutor) driver;
//Identify the WebElement which will appear after scrolling down
WebElement element = driver.findElement(By.tagName("...."));
// now execute query which actually will scroll until that element is not appeared on page.
je.executeScript("arguments[0].scrollIntoView(true);",element);
Run Code Online (Sandbox Code Playgroud)