0

我正在尝试从与 jQuery 插件调用 selectmenu 分层的下拉菜单中进行选择。我正在尝试使用 webdriver 从该下拉菜单中选择可见文本。

以下是页面来源

<body>
<form action="#">
<ul id="speedAa-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-all ui-selectmenu-menu-popup" aria-labelledby="speedAa-button" role="listbox" aria-hidden="true" style="width: 147px; height: 150px; left: 107.65px; top: -74.6px;" aria-activedescendant="ui-selectmenu-item-106">
<ul id="speedB-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-all ui-selectmenu-menu-popup" aria-labelledby="speedB-button" role="listbox" aria-hidden="true" style="width: 274px; left: 122.733px; top: 241.85px;" aria-activedescendant="ui-selectmenu-item-338">
<ul id="speedD-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-bottom ui-selectmenu-menu-dropdown" aria-labelledby="speedD-button" role="listbox" aria-hidden="true" style="width: 400px; left: 122.733px; top: 557.75px;" aria-activedescendant="ui-selectmenu-item-970">
<ul id="files-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-all ui-selectmenu-menu-popup" aria-labelledby="files-button" role="listbox" aria-hidden="true" style="width: 147px; left: 93.65px; top: 571.2px;" aria-activedescendant="ui-selectmenu-item-310">
<ul id="filesC-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-all ui-selectmenu-menu-popup" aria-labelledby="filesC-button" role="listbox" aria-hidden="true" style="width: 147px; left: 93.65px; top: 779.1px;" aria-activedescendant="ui-selectmenu-item-343">
<ul id="filesB-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-all customicons ui-selectmenu-menu-popup" aria-labelledby="filesB-button" role="listbox" aria-hidden="true" style="width: 147px; left: 93.65px; top: 750.65px;" aria-activedescendant="ui-selectmenu-item-376">
<div style="position: absolute; top: 20px; right: 10px;">
<div style="position: absolute; float: left; font-family: Trebuchet MS,Verdana,sans-serif; font-size: 12px; background: none repeat scroll 0% 0% rgb(0, 0, 0); color: rgb(255, 255, 255); padding: 8px 3px 3px; border-width: 0px 1px 1px; border-style: none solid solid; border-color: -moz-use-text-color rgb(204, 204, 204) rgb(204, 204, 204); -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; z-index: 999999; width: 144px; display: none;">
<ul id="speedA-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-all ui-selectmenu-menu-popup" aria-labelledby="speedA-button" role="listbox" aria-hidden="true" style="width: 147px; left: 107.65px; top: 105.95px;" aria-activedescendant="ui-selectmenu-item-35">
<ul id="speedC-menu" class="ui-selectmenu-menu ui-widget ui-widget-content ui-corner-bottom ui-selectmenu-menu-dropdown ui-selectmenu-open" aria-labelledby="speedC-button" role="listbox" aria-hidden="false" style="width: 173px; left: 107.65px; top: 450.3px;" aria-activedescendant="ui-selectmenu-item-391">
<li class="whoo" role="presentation">
<li class="" role="presentation">
<li class="ui-selectmenu-item-selected ui-selectmenu-item-focus ui-state-hover" role="presentation">
**<a id="ui-selectmenu-item-391" aria-selected="true" role="option" tabindex="-1" href="#">Medium</a>**
</li>
<li class="" role="presentation">
<li class="ui-corner-bottom" role="presentation">
4

1 回答 1

0

您可以使用 chrome 开发工具并尝试获取 xpath,或者右键单击您想要的元素并检查它,您将看到它在 DOM 上的位置。

于 2012-08-03T04:09:55.243 回答