Assertions
Assertions compare runtime behaviour against expected behaviour.
Assertions are used for "verification" or "checking" of functionality
Assertions are an integral part of Sahi scripts. A normal script would contain a series of actions followed by verification of functionality.
_assert
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assert($condition[, $message])
Arguments
$condition | boolean | condition to verify |
$message | string optional | message to log if condition fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert
Details
_assert will do nothing if the condition passed to it is true.
_assert will log failures to the playback logs if the condition evaluates to false.
_assert will do nothing if the condition passed to it is true.
_assert will log failures to the playback logs if the condition evaluates to false.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertTrue
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertTrue($condition[, $message])
Arguments
$condition | boolean | condition to verify |
$message | string optional | message to log if condition fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert True
Details
Same as _assert
Same as _assert
_assertNotTrue
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNotTrue($condition[, $message])
Arguments
$condition | boolean | condition which is expected to evaluate to false |
$message | string optional | message to log if condition evaluates to true |
Returns
null |
Sahi Pro Flowcharts Action :Assert Not True
Details
_assertNotTrue will do nothing if the condition evaluates to false.
_assertNotTrue will log failures to the playback logs if the condition evaluates to true.
_assertNotTrue will do nothing if the condition evaluates to false.
_assertNotTrue will log failures to the playback logs if the condition evaluates to true.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertFalse
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertFalse($condition[, $message])
Arguments
$condition | boolean | condition which is expected to evaluate to false |
$message | string optional | message to log if condition evaluates to true |
Returns
null |
Sahi Pro Flowcharts Action :Assert False
Details
_assertFalse will do nothing if the condition evaluates to false.
_assertFalse will log failures to the playback logs if the condition evaluates to true.
_assertFalse will do nothing if the condition evaluates to false.
_assertFalse will log failures to the playback logs if the condition evaluates to true.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertNull
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNull($value[, $message])
Arguments
$value | anything | Anything to be checked for null |
$message | string optional | message to log if value is not null |
Returns
null |
Sahi Pro Flowcharts Action :Assert Null
Details
_assertNull will do nothing if the value passed is null.
_assertNull will log failures to the playback logs if the value is not null.
_assertNull will do nothing if the value passed is null.
_assertNull will log failures to the playback logs if the value is not null.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertNotNull
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNotNull($value[, $message])
Arguments
$value | anything | Anything to be checked for not null |
$message | string optional | message to log if value is null |
Returns
null |
Sahi Pro Flowcharts Action :Assert Not Null
Details
_assertNotNull will do nothing if the value passed is not null.
_assertNotNull will log failures to the playback logs if the value is null.
_assertNotNull will do nothing if the value passed is not null.
_assertNotNull will log failures to the playback logs if the value is null.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertExists
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertExists($element[, $message])
Arguments
$element | HTML DOM element | element to be checked for existence |
$message | string optional | message to log if element does not exist on page |
Returns
null |
Sahi Pro Flowcharts Action :Assert Exists
Details
_assertExists will do nothing if the element exists.
_assertExists will log failures to the playback logs if the element does not exist
_assertExists will do nothing if the element exists.
_assertExists will log failures to the playback logs if the element does not exist
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertVisible
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.0.0 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertVisible($element[, $message])
Arguments
$element | HTML DOM element | element to be checked for visibility. |
$message | string optional | message to log if element is not visible. |
Returns
null |
Sahi Pro Flowcharts Action :Assert Visible
Details
_assertVisible will do nothing if the element is visible.
_assertVisible will log failures to the playback logs if the element is not visible
_assertVisible will do nothing if the element is visible.
_assertVisible will log failures to the playback logs if the element is not visible
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertNotVisible
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.0.0 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNotVisible($element[, $message])
Arguments
$element | HTML DOM element | element to be checked for not visible. |
$message | string optional | message to log if element is visible. |
Returns
null |
Sahi Pro Flowcharts Action :Assert Not Visible
Details
_assertNotVisible will do nothing if the element is not visible.
_assertNotVisible will log failures to the playback logs if the element is visible
_assertNotVisible will do nothing if the element is not visible.
_assertNotVisible will log failures to the playback logs if the element is visible
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertNotExists
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNotExists($element[, $message])
Arguments
$element | HTML DOM element | element to be checked for non existence |
$message | string optional | message to log if element exists on page |
Returns
null |
Sahi Pro Flowcharts Action :Assert Not Exists
Details
_assertNotExists will do nothing if the element does not exist.
_assertNotExists will log failures to the playback logs if the element exists
_assertNotExists will do nothing if the element does not exist.
_assertNotExists will log failures to the playback logs if the element exists
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertEqual
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertEqual($expected, $actual[, $message])
Arguments
$expected | any | Expected value. This value can be any normal javascript data type or an array Regular expressions can also be used. (eg. "/del/") |
$actual | any | Actual value. This value can be any normal javascript data type or an array. It is mostly some attribute of a HTML DOM element. |
$message | string optional | Message to be written to logs if the expected and actual values are not equal |
Returns
null |
Sahi Pro Flowcharts Action :Assert Equal
Details
_assertEqual will do nothing if the expected and actual values match.
_assertEqual will log failures to the playback logs if the expected and actual values are not equal
_assertEqual will do nothing if the expected and actual values match.
_assertEqual will log failures to the playback logs if the expected and actual values are not equal
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertEqualArrays
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertEqualArrays($expected, $actual[, $message])
Arguments
$expected | array | Expected array. |
$actual | array | Actual array. |
$message | string optional | Message to be written to logs if the expected and actual values are not equal |
Returns
null |
Sahi Pro Flowcharts Action :Assert Equal Arrays
Details
Asserts that expected and actual arrays are equal, else logs the message.
Asserts that expected and actual arrays are equal, else logs the message.
dangerDEPRECATED:
This is internally called by _assertEqual if expected and actual are arrays.
Use _assertEqual instead
_assertNotEqual
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNotEqual($expected, $actual[, $message])
Arguments
$expected | any | Expected value. This value can be any normal javascript data type or an array Regular expressions can also be used. (eg. "/del/") |
$actual | any | Actual value. This value can be any normal javascript data type or an array. It is mostly some attribute of a HTML DOM element. |
$message | string optional | Message to be written to logs if the expected and actual values are equal |
Returns
null |
Sahi Pro Flowcharts Action :Assert Not Equal
Details
_assertNotEqual will do nothing if the expected and actual values do not match.
_assertNotEqual will log failures to the playback logs if the expected and actual values are equal
_assertNotEqual will do nothing if the expected and actual values do not match.
_assertNotEqual will log failures to the playback logs if the expected and actual values are equal
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertContainsText
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertContainsText($expected, $element[, $message])
Arguments
$expected | string | Expected string. Regular expressions can also be used. (eg. "/del/") |
$element | HTML DOM element | Element. We check if expected is a part of the text of this element. |
$message | string optional | Message to be written to logs if the expected string is not part of the text of given element |
Returns
null |
Sahi Pro Flowcharts Action :Assert Contains Text
Details
_assertContainsText will do nothing if the expected string/regex is part of the text content of given element.
_assertContainsText will log failures to the playback logs if the expected string/regex is not part of the text content of given element
_assertContainsText will do nothing if the expected string/regex is part of the text content of given element.
_assertContainsText will log failures to the playback logs if the expected string/regex is not part of the text content of given element
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertNotContainsText
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
3.5 | 7.0.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertNotContainsText($expected, $element[, $message])
Arguments
$expected | string | Expected string. Regular expressions can also be used. (eg. "/del/") |
$element | HTML DOM element | Element. We check if expected is not a part of the text of this element. |
$message | string optional | Message to be written to logs if the expected string is part of the text of given element |
Returns
null |
Sahi Pro Flowcharts Action :Assert Not Contains Text
Details
_assertNotContainsText will do nothing if the expected string/regex is not part of the text content of given element.
_assertNotContainsText will log failures to the playback logs if the expected string/regex is part of the text content of given element
_assertNotContainsText will do nothing if the expected string/regex is not part of the text content of given element.
_assertNotContainsText will log failures to the playback logs if the expected string/regex is part of the text content of given element
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
_assertEqualImages
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.0.0 | 7.5.0 | 7.5.0 | 9.0.0 | NA |
Available for modes: Browser | Windows | Java | Android | iOS | SAP
_assertEqualImages($expectedImagePath, $actualImagePath[, $differenceThreshold[, $displayOnSuccess[, $failureMessage]]])
Arguments
$expectedImagePath | string | Expected image path. Relative paths will be resolved relative to current executing script. |
$actualImagePath | string | Actual image path. Relative paths will be resolved relative to current executing script. |
$differenceThreshold | float optional | If the difference between the two images is lesser than or equal to the differenceThreshold number, they are considered to be same. |
$displayOnSuccess | boolean optional | When true, the expected image, actual image and the differential image will be embedded in the playback log, if the assertion succeeds.
Default is false, which means only dissimilar images will be logged. Note that these images will always be embedded in case of assertion failure. |
$failureMessage | string optional | Message to be written to logs if the image comparison fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Equal Images
Details
_assertEqualImages compares two images. If the images are similar, assertion passes. If the images are dissimilar, the images and the failure messasge will be displayed in logs as failure.
_assertEqualImages compares two images. If the images are similar, assertion passes. If the images are dissimilar, the images and the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _compareImages instead.
infoThis api is dependent on GraphicsMagick software.
To configure the GraphicsMagick on the system, refer Configuring GraphicsMagick
warning
If _sahi.SKIP_ASSERT_SNAPSHOTS is specified as true, this API will be skipped.
_assertHorizontallyAligned
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertHorizontallyAligned($leftElement, $rightElement[, $position[, $gap[, $offset[, $message]]]])
Arguments
$leftElement | HTML DOM element | Left element to be asserted. |
$rightElement | HTML DOM element | Right element to be asserted. |
$position | string optional | Position to be checked. By default position = "middle". Value of position can be either "top" or "bottom" or "both" or "middle". |
$gap | integer array|integer optional | Gap between right edge of left element and left edge of right element. If gap is an integer, it will take the exact value. And if gap is an array, Eg. gap = [10, 40], implies gap can range from 10 to 40. To force sahi to check for the gap between the two elements, use the gap. If nothing provided it wouldn't consider gap. |
$offset | integer array|integer optional | Offset above and below within which to look for elements boundary for given position. If offset is an integer, both above and below offsets are set to this offset. rightElement may be slightly above or below leftElement. Sahi normally matches only elements whose bases match. To force it to look a little above or below while looking to the right, use the offset. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Horizontally Aligned
Details
_assertHorizontallyAligned checks if two elements are horizontally aligned. If the elements are horizontally aligned, assertion passes. If the elements are not horizontally aligned, the failure messasge will be displayed in logs as failure.
_assertHorizontallyAligned checks if two elements are horizontally aligned. If the elements are horizontally aligned, assertion passes. If the elements are not horizontally aligned, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _areHorizontallyAligned instead.
Example
_assertHorizontallyAligned(_div("item1"), _div("item2")) //by default middle position will be checked
_assertHorizontallyAligned(_div("item1"), _div("item2"), "top")
_assertHorizontallyAligned(_div("item1"), _div("item2"), "top", 20) //gap can take the values between [-20, 20]
_assertHorizontallyAligned(_div("item1"), _div("item2"), "top", [0, 20]) //gap is only positive i.e. no overlapping is allowed
_assertHorizontallyAligned(_div("item1"), _div("item2"), "top", [0, 20], 10) //gap is only positive i.e. no overlapping is allowed and offset for the top edge is 10
_assertVerticallyAligned
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertVerticallyAligned($topElement, $bottomElement[, $position[, $gap[, $offset[, $message]]]])
Arguments
$topElement | HTML DOM element | Top element to be asserted. |
$bottomElement | HTML DOM element | Bottom element to be asserted. |
$position | string optional | Position to be checked. By default position = "center". Value of position can be either "left" or "right" or "both" or "center". |
$gap | integer array|integer optional | Gap between bottom edge of top element and top edge of bottom element. If gap is an integer, it will take the exact value. And if gap is an array, Eg. gap = [0, 40], implies gap can range from 0 to 40. To force sahi to check for the gap between the two elements, use the gap. If nothing provided it wouldn't consider gap. |
$offset | integer array|integer optional | Offset left and right within which to look for elements boundary for given position. If offset is an integer, both left and right offsets are set to this offset. topElement may be slightly left or right to the bottomElement. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Vertically Aligned
Details
_assertVerticallyAligned checks if two elements are vertically aligned. If the elements are vertically aligned, assertion passes. If the elements are not vertically aligned, the failure messasge will be displayed in logs as failure.
_assertVerticallyAligned checks if two elements are vertically aligned. If the elements are vertically aligned, assertion passes. If the elements are not vertically aligned, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _areVerticallyAligned instead.
Example
_assertVerticallyAligned(_div("item1"), _div("item2")) //by default center position will be checked
_assertVerticallyAligned(_div("item1"), _div("item2"), "left")
_assertVerticallyAligned(_div("item1"), _div("item2"), "left", 20) //gap can take the values between [-20, 20]
_assertVerticallyAligned(_div("item1"), _div("item2"), "left", [0, 20]) //gap is only positive i.e. no overlapping is allowed
_assertCentered
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertCentered($element, $containerElement, $alignment[, $message])
Arguments
$element | HTML DOM element | Inner element to be asserted. |
$containerElement | HTML DOM element | Container element to be asserted. |
$alignment | string | Can be "vertical" or "horizontal". |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Centered
Details
_assertCentered checks if inner element is vertically or horizontally centered to the container element. If the elements are vertically or horizontally aligned, assertion passes. If the elements are not vertically or horizontally aligned, the failure messasge will be displayed in logs as failure.
_assertCentered checks if inner element is vertically or horizontally centered to the container element. If the elements are vertically or horizontally aligned, assertion passes. If the elements are not vertically or horizontally aligned, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _isCentered instead.
Example
_assertCentered(_div("item1"), _div("item2"), "vertical")
_assertCentered(_div("item1"), _div("item2"), "horizontal")
_assertVisiblyInside
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertVisiblyInside($element1, $element2[, $message])
Arguments
$element1 | HTML DOM element | First element to be asserted. |
$element2 | HTML DOM element | Second element to be asserted. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Visibly Inside
Details
_assertVisiblyInside checks if element1 is visibly inside element2. If element1 is visibly inside element2, assertion passes. If element1 is not visibly inside element2, the failure messasge will be displayed in logs as failure.
_assertVisiblyInside checks if element1 is visibly inside element2. If element1 is visibly inside element2, assertion passes. If element1 is not visibly inside element2, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _isVisiblyInside instead.
_assertVisiblyOutside
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertVisiblyOutside($element1, $element2[, $message])
Arguments
$element1 | HTML DOM element | First element to be asserted. |
$element2 | HTML DOM element | Second element to be asserted. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Visibly Outside
Details
_assertVisiblyOutside checks if element1 is visibly outside element2 i.e one is not contained within other. If element1 is visibly outside element2, assertion passes. If element1 is not visibly outside element2, the failure messasge will be displayed in logs as failure.
_assertVisiblyOutside checks if element1 is visibly outside element2 i.e one is not contained within other. If element1 is visibly outside element2, assertion passes. If element1 is not visibly outside element2, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _isVisiblyOutside instead.
_assertVisiblyOn
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertVisiblyOn($element1, $element2[, $topSpace[, $rightSpace[, $bottomSpace[, $leftSpace[, $message]]]]])
Arguments
$element1 | HTML DOM element | First element to be asserted. |
$element2 | HTML DOM element | Second element to be asserted. Base Element. |
$topSpace | integer array|integer optional | Space between top edges of the two elements. If topSpace is an integer, it will take the exact value. And if topSpace = [-20, 0], implies top edge of element2 lies above top edge of element1. To force sahi to check for the topSpace between the two elements, use the topSpace. If nothing provided it wouldn't consider topSpace. |
$rightSpace | integer array|integer optional | Space between right edges of the two elements. If rightSpace is an integer, it will take the exact value. And if rightSpace = [0, 20], implies right edge of element2 lies to the right side of right edge of element1. To force sahi to check for the rightSpace between the two elements, use the rightSpace. If nothing provided it wouldn't consider rightSpace. |
$bottomSpace | integer array|integer optional | Space between bottom edges of the two elements. If bottomSpace is an integer, it will take the exact value. And if bottomSpace = [0, 20], implies bottom edge of element2 lies below bottom edge of element1. To force sahi to check for the bottomSpace between the two elements, use the bottomSpace. If nothing provided it wouldn't consider bottomSpace. |
$leftSpace | integer array|integer optional | Space between left edges of the two elements. If leftSpace is an integer, it will take the exact value. And if leftSpace = [0, 20], implies top edge of element2 lies to the right side of left edge of element1. To force sahi to check for the leftSpace between the two elements, use the leftSpace. If nothing provided it wouldn't consider leftSpace. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Visibly On
Details
_assertVisiblyOn checks if element1 placed on element2. element1 may extend beyond element2 boundaries. If element1 is visibly placed on element2, assertion passes. If element1 is not visibly placed on element2, the failure messasge will be displayed in logs as failure.
_assertVisiblyOn checks if element1 placed on element2. element1 may extend beyond element2 boundaries. If element1 is visibly placed on element2, assertion passes. If element1 is not visibly placed on element2, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _isVisiblyOn instead.
Example
_assertVisiblyOn(_div("item1"), _div("item2"), [0,25]); //implies _div("item1") is placed on _div("item2") where top edge of div("item1") can be upto
// 25 units below div("item2") top edge
_assertFitsWidth
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertFitsWidth($element1, $element2[, $leftSpace[, $rightSpace[, $message]]])
Arguments
$element1 | HTML DOM element | First element to be asserted. |
$element2 | HTML DOM element | Second element to be asserted. Base Element. |
$leftSpace | integer array|integer optional | Space between left edges of the two elements. If leftSpace is an integer, it will take the exact value. And if leftSpace = [0, 20], implies top edge of element2 lies to the right side of left edge of element1. If nothing provided leftSpace will be considered as 0. |
$rightSpace | integer array|integer optional | Space between right edges of the two elements. If rightSpace is an integer, it will take the exact value. And if rightSpace = [0, 20], implies right edge of element2 lies to the right side of right edge of element1. If nothing provided rightSpace will be considered as 0. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Fits Width
Details
_assertFitsWidth checks if element1 fits within the width of element2. If element1 fits within element2, assertion passes. If element1 does not fits within element2, the failure messasge will be displayed in logs as failure.
_assertFitsWidth checks if element1 fits within the width of element2. If element1 fits within element2, assertion passes. If element1 does not fits within element2, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _fitsWidth instead.
Example
_assertFitsWidth(_div("item1"), _div("item2"), [0,25], [-25,0]); //implies _div("item1") is on _div("item2") where left edge of div("item1") can be
//upto 25 units right to div("item2") left edge and right edge of div("item1") can be upto 25 units left to div("item2") right edge
_assertFitsHeight
Since: | Sahi Pro | Desktop Add-On | Mobile Add-On | SAP Add-On | AI Assist Add-On |
6.3.0 | 8.0.0 | NA | NA | NA |
Available for modes: Browser | Windows | Java
_assertFitsHeight($element1, $element2[, $topSpace[, $bottomSpace[, $message]]])
Arguments
$element1 | HTML DOM element | First element to be asserted. |
$element2 | HTML DOM element | Second element to be asserted. Base Element. |
$topSpace | integer array|integer optional | Space between top edges of the two elements. If topSpace is an integer, it will take the exact value. And if topSpace = [-20, 0], implies top edge of element2 lies above top edge of element1. If nothing provided topSpace will be considered as 0. |
$bottomSpace | integer array|integer optional | Space between bottom edges of the two elements. If bottomSpace is an integer, it will take the exact value. And if bottomSpace = [0, 20], implies bottom edge of element2 lies below bottom edge of element1. If nothing provided bottomSpace will be considered as 0. |
$message | string optional | Message to be written to logs if the assertion fails |
Returns
null |
Sahi Pro Flowcharts Action :Assert Fits Height
Details
_assertFitsHeight checks if element1 fits within the height of element2. If element1 fits within element2, assertion passes. If element1 does not fits within element2, the failure messasge will be displayed in logs as failure.
_assertFitsHeight checks if element1 fits within the height of element2. If element1 fits within element2, assertion passes. If element1 does not fits within element2, the failure messasge will be displayed in logs as failure.
danger
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the assertion fails
Use _fitsHeight instead.
Example
_assertFitsHeight(_div("item1"), _div("item2"), [0,25], [-25,0]); //implies _div("item1") is on _div("item2") where top edge of div("item1") can be
//upto 25 units below div("item2") top edge and bottom edge of div("item1") can be upto 25 units above div("item2") bottom edge