Python makes a distinction between numbers and strings, so if you have a number as a string (e.g., “562”), and want to access the value as a number, you must explicitly convert it.
Normally this is easily done using the standard Python syntax
i = int(s) where
s is a string and
i is the number it represents. But if you do this in a Squish test script it won't work. Instead you'll get an error message like this:
Unfortunately, Squish defines its own
type()) function, so the standard Python versions of these functions are not directly available.
It is, of course, possible to access the original standard Python functions by accessing them via the
builtin module. This involves explicitly importing the
builtin module as follows:
Now the rest of the script can use Python's standard
type()) functions by using their fully-qualified names. For example: