GeneralFunctions
Constants
data formats
- RE_LONG_DATE - regular expression for a long date, ex: January 12, 2000.
- STRF_LONG_DATE - formator for strptime to parse text into datetime object.
- RE_COUNT - regular expression for a count including zero.
- RE_NON_ZERO_COUNT - regular expression for a count greater that zero.
Verify Text in Pages
verifyText(str, sel)
Looks for text 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 text 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.