【发布时间】:2016-11-30 01:48:41
【问题描述】:
我想在 selenium on python 3 的网站上找到一个按钮元素。我尝试了一些不同的方法,但都失败了。我使用Xpath 来查找我的元素,但我不知道这是否是更好的方法:
这是HTML 代码:
<div id="review-buttons-container">
<div class="columns">
<div class="please-wait" id="review-please-wait" style="display:none;">
<span>PROCESSING...</span>
</div>
<input id="place_order" type="button" value="Complete Order" class="button end"/>
</div>
</div>
这是我已经在 python 上尝试过的:
br.find_element_by_xpath("//input[@id='place_order']").click()
返回:
selenium.common.exceptions.WebDriverException:消息:未知错误:元素在点(606、678)不可点击。其他元素会收到点击:
...
//div[@id='review-buttons-container']/div/input
返回:
selenium.common.exceptions.NoSuchElementException:消息:没有这样的 元素:无法定位元素: {"method":"xpath","selector":"//div[@id='review-buttons-container']/div/input"}
br.find_element_by_xpath("//form[2]/div[8]/div/input").click()
selenium.common.exceptions.NoSuchElementException:消息:没有这样的 元素:无法定位元素: {"method":"xpath","selector":"//form[2]/div[8]/div/input"}
有什么想法吗?谢谢
【问题讨论】:
标签: python html python-3.x selenium selenium-webdriver