GeneralFunctions

From MozillaWiki
Revision as of 19:13, 15 April 2010 by Twsmith (talk | contribs) (Created page with '== Constants == (copy from AMOfunctions) == Verify Text in Pages == === verifyText(str, sel) === Looks for the string on the web-page * ''str'' - text to look for * ''sel'' - …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Constants

(copy from AMOfunctions)

Verify Text in Pages

verifyText(str, sel)

Looks for the string on the web-page

  • str - text to look for
  • sel - selenium instance
  • Returns True if str is found else False

verifyTextNotPresent(str, sel)

Looks for the string on the web-page

  • str - text to look for
  • sel - selenium instance
  • Returns True if str is not found else False

verifyPageTitle(title_regexp, actual_title, sel)

  • title_regexp - regular expression used in match
  • actual_title - text used in match
  • Returns True if actual_title matches the regular expression title_regexp, otherwise False.

Data Conversions

textToInteger(inText)

Searches text for an integer and converts to a number

  • inText - text which contains an integer, may include commas
  • Returns the tuple ( results , number )

If a number was found the returned tuple is the null string and the number as an integer. If the string contains multiple numbers only the first is returned. If no number was found the tuple is an error message string and 0.

longDateTextToDatetime(inText)

Searches text for a date in the 'long date' format and converts to a datetime data type.

  • inText - text which contains the date
  • Returns the tuple ( results, date )

If a date with a format similar to 'January 1, 2000' is found the returned tuple is the null string and the date as a datetime date type. If the string contains multiple dates of the format only the first is returned. If no date of the format was found the tuple is an error message string and the date January 1, 0001 as a datetime data type.

cleanNonAscii(inText)

Converts non-printable characters

  • inText - input text
  • Returns inText with any non-printable characters replaced with character code value.