我有5个列的HTML表格。在第三列是链接,在第五列是日期。
现在我想编写一个代码,检查日期是否在接下来的4周内,如果是,则点击链接。 但如果我运行我的代码,我会收到此错误:
时间数据[selenium.webdriver.remote.webelement.WebElement(session =“5395379b492ea99d3df3ffaf80718908”,element =“0.7086675347389584-2”)]与格式'%Y-%m-%d'不匹配
这是我的代码:
axios.get('http://localhost:9000/test')
.then(function (response) {
const parsedResponse = JSON.parse(response);
console.log(parsedResponse.name));
});
这是HTML表格中日期为:
的部分# Set the Date
start = time.strftime('%Y-%m-%d')
now = datetime.datetime.strptime(start, '%Y-%m-%d')
date_in_four_weeks = now + datetime.timedelta(days=28)
print start
print now
print date_in_four_weeks
#Clickpath through the table
td_list = WebDriverWait(driver, 10).until(lambda driver: driver.find_elements_by_css_selector("css_selector"))
for td in td_list:
date_list = []
date = driver.find_elements_by_tag_name('time')
for d in date:
date_list.append(d.text)
print d.get_attribute('datetime')
print date_list
for i in range(project_time.days + 1):
print(now + timedelta(days=i))
date2 = datetime.datetime.strptime(str(date), '%Y-%m-%d')
if date_list <= now + timedelta(days=i):
linkList = driver.find_elements_by_css_selector("css_selector")
for i in range(0,len(linkList)):
links = driver.find_elements_by_partial_link_text('SOLI')
links[i].click()
driver.get_screenshot_as_file("SeeWhatWeHaveHere_%s.png" % (a))
else:
print " NAAAH"
我是Python的新手,所以我不知道如何解决这个问题。
请帮助。谢谢:))
完整输出:
<td class="customfield_10090">
<span title="31.08.17">
<time datetime="2017-08-31">31.08.17</time>
</span>
</td>