<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:
(By.xpath("//a[@id='SIU2_country']/div/div/span[contains(text(),'United Kingdom')]"));
如何使用 id 或 cssselector 从下拉列表中选择英国?
谢谢!