比较 Xpath 中不同格式的日期 [英] Comparing dates in Xpath with different formats

查看:42
本文介绍了比较 Xpath 中不同格式的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这种格式的日期21-Mar-2014"

I have a date in this format "21-Mar-2014"

我已经尝试搜索 Xpath 公式但没有用

I already tried to search for Xpath formulas but with no use

我正在使用 SeleniumIDE 获取第一个格式 21-Mar-2014 并想检查此值是否是今天的日期,那么xpath如何生成今天的日期并将其与使用Selenium提取的日期进行比较

I am getting the first format 21-Mar-2014 using SeleniumIDE and want to check if this value is the date of today, So how can xpath generate today's date and compare it for the date extracted using Selenium

推荐答案

您可以使用诸如 date:date(string) 之类的 xpath 函数将字符串解析为日期(在 这个问题).

You can parse the string into a date with an xpath function such as date:date(string) (described in this question).

今天的日期已经是 xml 日期格式,由 fn:current-date() 提供(参见 这里)

Today's date already in xml date format is supplied by fn:current-date() (see here)

这篇关于比较 Xpath 中不同格式的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆