0
<a id="SIU2_country" class="button combobox-button country" onclick="event.cancelBubble = true; if (event.stopPropagation) { event.stopPropagation(); }" tabindex="9" style="cursor: auto;">
<span id="SIU2_country_span"> </span>
<div class="combobox-menu" style="width: 298px; max-height: 212px; display: block;">
<div class="combobox-menu-item">
<span>United States</span>
</div>
<div class="combobox-menu-item">
<span>United Kingdom</span>
</div>
<div class="combobox-menu-item">
試圖避免的webdriver使用XPath:使用ID或cssselector從下拉列表的webdriver - 從下拉列表中選擇國家,而不使用XPath
(By.xpath("//a[@id='SIU2_country']/div/div/span[contains(text(),'United Kingdom')]"));
如何選擇英國?
謝謝!
謝謝。將堅持xpath這個元素。我儘量避免在webdriver中使用xpath。 – SUM