質問

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