【发布时间】:2016-08-31 07:59:57
【问题描述】:
点击了元素,我没有收到任何错误,但弹出窗口(Facebook 中的“添加精选照片”弹出窗口)仍然存在。它没有关闭。
这是html代码:
<div class="_5lnf uiOverlayFooter _5a8u">
<table class="uiGrid _51mz uiOverlayFooterGrid" cellspacing="0" cellpadding="0">
<tbody>
<tr class="_51mx">
<td class="_51m- prs uiOverlayFooterMessage">
<td class="_51m- uiOverlayFooterButtons _51mw">
<a class="_42ft _4jy0 layerCancel uiOverlayButton _4jy3 _517h _51sy" href="#" role="button">Cancel</a>
<button class="_42ft _4jy0 layerConfirm uiOverlayButton _4jy3 _4jy1 selected _51sy" type="submit" value="1">Save</button>
</td>
</tr>
</tbody>
</table>
</div>
这是我的代码:
driver.find_element_by_xpath(".//button[@class='_42ft _4jy0 layerConfirm uiOverlayButton _4jy3 _4jy1 selected _51sy']")
如何点击“保存”按钮关闭弹出窗口?非常感谢:)
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver xpath