我正在尝试使用 java 和 selenium 从站点的下拉菜单中选择一个选项。由于唯一的类名,我可以单击 7 号。但是我无法像我想要的那样点击 9 或 10.5 号。所以我想知道我是否可以根据 rel 属性点击?
<li class="nsg-form--drop-down--option first-in-row upper-left" rel="3161894:7"> 7 </li>
<li class="nsg-form--drop-down--option" rel="3161895:7.5"> 7.5 </li>
<li class="nsg-form--drop-down--option last-in-row upper-right" rel="3161896:8"> 8 </li>
<li class="nsg-form--drop-down--option first-in-row" rel="3161897:8.5"> 8.5 </li>
<li class="nsg-form--drop-down--option" rel="3161898:9"> 9 </li>
<li class="nsg-form--drop-down--option last-in-row" rel="3161899:9.5"> 9.5 </li>
<li class="nsg-form--drop-down--option first-in-row" rel="3161900:10"> 10 </li>
<li class="nsg-form--drop-down--option" rel="3161901:10.5"> 10.5 </li>
<li class="nsg-form--drop-down--option last-in-row" rel="3161902:11"> 11 </li>
<li class="nsg-form--drop-down--option first-in-row" rel="3161903:11.5"> 11.5 </li>
我试过了:
selenium.click("rel=3161898");
selenium.mouseDown("rel=3161898);
selenium.mouseUp("rel=3161898);