【发布时间】:2015-03-17 07:58:27
【问题描述】:
谁能帮我在网络浏览器弹出窗口中选择“Logitech UE 4500”。
用于 HTML 的 PSB 已通过“driver.page_source”。
<list id="bluetooth-paired-devices-list" role="list" tabindex="0">
<div class="spacer" style="height: 0px;">
</div>
<div role="listitem" class="deletable-item bluetooth-device" paired="paired">
<div>
<div class="bluetooth-device-label">Logitech UE 4500</div>
</div>
<button class="raw-button row-delete-button custom-appearance" tabindex="-1" title="Delete this item">
</button>
</div>
<div class="spacer" style="height: 0px;">
</div>
</list>
<div role="listitem" class="deletable-item bluetooth-device">
<div><div class="bluetooth-device-label">KKHAMPOX-MOBL2</div>
【问题讨论】:
-
嗨 Anzel,在下面尝试过,但没有用
-
driver.find_element_by_xpath("//div[contains(@class, 'Logitech UE 4500')]").click()
-
driver.find_element_by_cssselector(".bluetooth-device-label > .Logitech UE 4500").click()
-
'Logitech UE 4500' 是 innerHTML/text 而不是 "class",因此你的尝试过不会完成你想要的。
-
@MuraliPerumal,如果这是一个弹出窗口,您需要确保在它可见时单击它。