android - 选择下拉菜单在 Android 浏览器上不活动

标签 android html

我遇到一个问题,当在 Android 移动设备上查看时,下拉选择框不会下拉(它基本上处于非 Activity 状态)。它在桌面浏览器和 ios 浏览器上运行良好 - 在 ios 上调出一个选择器轮,在桌面上调出一个下拉选择列表。

示例代码是;

<select id = "log_or_norm" autofocus>
<option value="1">Lognormal</option>
<option value="2">Normal</option>
</select>

我尝试了找到的建议; http://youngliferamblings.wordpress.com/2011/08/09/select-dropdown-in-android-webview/

这是

The select tag just doesn’t work sometimes in Android, especially in an app using webview. This drove me nuts for a long long time. The main fix I found, even if your select is buried deep in divs and rows and what ever, is this css:

select { visibility: visible; -webkit-appearance: menulist-text; }

The -webkit-appearance might be the only one actually needed and setting it to ‘listbox’ works too.

That’s all. This deserved its own post.

运气不好....

我希望这里的一位专家可以提供一个优雅的解决方案,避免我不得不为每个选项制作独立按钮。我不关心 Android 体验是否有一个不错的选择器轮,但需要能够让 Android 用户选择一个选项。

提前致谢

最佳答案

尝试

getDriver().createElement(By.id("your locator"));
getDriver().createElement(By.id("your locator")).sendKeys("option Name you want to give");

关于android - 选择下拉菜单在 Android 浏览器上不活动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9028822/

相关文章:

android - 尝试拍照时应用程序崩溃

java - 将 onClickListener 设置为自定义适配器

html - 仅使用 CSS 重构响应式设计中的部分

javascript - 我想在图像 <img source =""> 标签的路径中写入图标名称

javascript - 在 JavaScript 中删除没有 ID 的子项

html - 如何将滚动条添加到小分辨率并在大分辨率中将其删除?

android - java.lang.NoClassDefFoundError : oauth. signpost.commonshttp.CommonsHttpOAuthConsumer android

android - 使用 onSearchRequested 传递 Bundle 时出现问题

Android 界面兼容性问题

javascript - 将链接与粘贴到输入标记的超链接隔离