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

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

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

有帮助吗?

解决方案

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

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

其他提示

You can get the value, sore it in a variable, and then compare it. Eg:

storeText   //xpath/goes/here                              myDate
storeEval   (new Date(storedVars['myDate']) > new Date())  isAfterToday

Note, the storedVars array holds all the variables. new Date should parse most formats, otherwise you can use any javascript in the storeEval stage to reformat it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top