【发布时间】:2014-11-27 09:48:09
【问题描述】:
我正在使用 selenium2library(python) 进行自动化。这是使用的方法
def get_appointment_from_manage(self, date, appt_id):
ref_date = "//*[@data-date=\"%s\"]" % date
time.sleep(2)
logging.info(date)
logging.info(appt_id)
while not self.is_element_present_by_xpath(ref_date) :
self._current_browser().find_element_by_xpath("//*[@id=\"calendar1\"]/div[1]/div[3]/div/button[2]").click();
time.sleep(2)
element = self._current_browser().find_element_by_xpath("//*[@data-aid=\"%s\"]" % appt_id)
logging.info(element)
ActionChains(self._current_browser()).move_to_element(element).click().perform()
日志记录表明该元素已找到但未单击。 这是没有点击的部分。
element = self._current_browser().find_element_by_xpath("//*[@data-aid=\"%s\"]" % appt_id)
logging.info(element)
ActionChains(self._current_browser()).move_to_element(element).click().perform()
当您检查元素时,整个元素都被蓝色覆盖。所以我不知道我错过了什么。 Firefox 版本是 28。提前致谢!
编辑
这是html
<div class="fc-event-container">
<div class="fc-event-box" style="position:relative;z-index:1"></div>
<div data-aid="31" class="fc-event-data-container fc-status-2" style="position:absolute;top:0px;right:0;bottom:-62px;left:0;z-index:1">
<div class="fc-event-data-box">
<a class="fc-time-grid-event fc-event fc-start fc-end evnt-1419408000000" style="top: 0px; bottom: -62px; z-index: 1; left: 0%; right: 0%;">
<div class="fc-content">
<div class="fc-time" data-start="8:00" data-full="8:00 AM - 8:30 AM" style="display:none;">
<span>8:00 - 8:30</span>
</div>
<div class="fc-title">Robot-FN</div>
<span class="fc-product">Home Loans</span>
</div>
<div class="fc-bg"></div>
</a>
</div>
</div>
</div>
【问题讨论】:
-
可以添加元素的 HTML 吗?
-
将 html 添加到问题中
-
点击后会发生什么?你有处理它的javascript或者你打算点击标签吗?
标签: python firefox selenium xpath selenium-webdriver