【发布时间】:2016-02-16 00:12:52
【问题描述】:
我正在尝试使用 python-selenium 绑定单击按钮;到目前为止,尝试了各种选择器,但没有任何运气。我正在使用 Chromedriver。
我可以使用elem = driver.find_element(by='xpath', value="//div[@id='gwt-debug-search-button']") 选择一个元素没有错误,但是当尝试点击它时显示element is not visible
我使用了动作链,它通过没有任何错误但没有点击按钮。我无法弄清楚问题所在。如果您以前解决过类似问题,请分享。
get_ideas = driver.find_element(by='xpath', value="//span[@id='gwt-debug-search-button-content'][normalize-space()='Get ideas']")
chains = ActionChains(driver)
chains.click(on_element=elem).perform()
这里是html源代码:
<div tabindex="0" class="goog-button-base goog-inline-block goog-button aw-btn aw-larger-button aw-save-button" role="button" id="gwt-debug-search-button">
<input type="text" tabindex="-1" role="presentation" style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="goog-button-base-outer-box goog-inline-block">
<div class="goog-button-base-inner-box goog-inline-block">
<div class="goog-button-base-pos">
<div class="goog-button-base-top-shadow"> </div>
<div class="goog-button-base-content">
<span id="gwt-debug-search-button-content">Get ideas</span>
</div>
</div>
</div>
</div>
</div>
【问题讨论】:
标签: javascript python selenium gwt