Skip to content

Positive Assertions

assertElementContainsText

Description: This function will assert if the Element's text contains the expected text

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementContainsText @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementContainsText Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementContainsText %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] contains the text [<Data>]", input = InputType.YES)
public void assertElementContainsText() {
    String text = "";
    try {
        LocatorAssertions.ContainsTextOptions options = new LocatorAssertions.ContainsTextOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).containsText(Data,options);
        text = Locator.textContent();
        highlightElement();
        Report.updateTestLog(Action, "Element [" + ObjectName + "] contains text '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not contain text '" + Data + "'. Actual text is '" + text + "'");
    }
}

assertElementContainsTextIgnoreCase

Description: This function will assert if the Element's text contains the expected text (case insensitive)

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementContainsTextIgnoreCase @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementContainsTextIgnoreCase Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementContainsTextIgnoreCase %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] contains the text [<Data>]", input = InputType.YES)
public void assertElementContainsTextIgnoreCase() {
    String text = "";
    try {
        LocatorAssertions.ContainsTextOptions options = new LocatorAssertions.ContainsTextOptions();
        options.setTimeout(getTimeoutValue());
        options.setIgnoreCase(true);
        assertThat(Locator).containsText(Data,options);
        text = Locator.textContent();
        highlightElement();
        Report.updateTestLog(Action, "Element [" + ObjectName + "] contains text '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not contain text '" + Data + "'. Actual text is '" + text + "'");
    }
}

assertElementHasAccessibleDescription

Description: This function will assert if the Element has an Accessible Description

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementHasAccessibleDescription @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementHasAccessibleDescription Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementHasAccessibleDescription %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has Accessible Description [<Data>]", input = InputType.YES)
public void assertElementHasAccessibleDescription() {

    try {
        LocatorAssertions.HasAccessibleDescriptionOptions options = new LocatorAssertions.HasAccessibleDescriptionOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).hasAccessibleDescription(Data,options);
        highlightElement();
        Report.updateTestLog(Action, "Element [" + ObjectName + "] has Accessible Description '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not contain expected Accessible Description");
    }
}

assertElementHasAccessibleName

Description: This function will assert if the Element has an Accessible Name

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementHasAccessibleName @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementHasAccessibleName Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementHasAccessibleName %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has Accessible Name [<Data>]", input = InputType.YES)
public void assertElementHasAccessibleName() {

    try {
        LocatorAssertions.HasAccessibleNameOptions options = new LocatorAssertions.HasAccessibleNameOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).hasAccessibleName(Data,options);
        highlightElement();
        Report.updateTestLog(Action, "Element [" + ObjectName + "] has Accessible Name '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not contain expected Accessible Name");
    }
}

assertElementAttributeMatches

Description: This function will assert if the Element has the expected attribute.

Input Format : AttributeName=AttributeValue

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementAttributeMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementAttributeMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementAttributeMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has the attribute [<Data>]", input = InputType.YES)
public void assertElementAttributeMatches() {
    String attributeName = Data.split("=")[0];
    String attributeValue = Data.split("=")[1];
    String actualattributeValue = "";
    try {
        LocatorAssertions.HasAttributeOptions options = new LocatorAssertions.HasAttributeOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).hasAttribute(attributeName, attributeValue,options);
        actualattributeValue = Locator.getAttribute(attributeName);
        highlightElement();
        Report.updateTestLog(Action, "Element [" + ObjectName + "] has attribute '" + attributeName + "' with value '" + attributeValue + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have attribute '" + attributeName + " = " + attributeValue + "'. Actual value is '" + actualattributeValue + "'");
    }
}

assertElementClassMatches

Description: This function will assert if the Element match the expected class

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementClassMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementClassMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementClassMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has class [<Data>]", input = InputType.YES)
public void assertElementClassMatches() {
    String actualClassValue = "";
    try {
        LocatorAssertions.HasClassOptions options = new LocatorAssertions.HasClassOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).hasClass(Pattern.compile(Data),options);
        actualClassValue = Locator.getAttribute("class");
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] has 'class' matching '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have 'class' matching '" + Data + "'. Actual value is '" + actualClassValue + "'");
    }
}

assertElementCountMatches

Description: This function will assert if the count of Element matches the expected count

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementCountMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementCountMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementCountMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if count of [<Object>] equals [<Data>]", input = InputType.YES)
public void assertElementCountMatches() {
    int elementCount = 0;
    try {
        LocatorAssertions.HasCountOptions options = new LocatorAssertions.HasCountOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).hasCount(Integer.parseInt(Data),options);
        elementCount = Locator.count();
        Report.updateTestLog(Action, "[" + ObjectName + "] count matches '" + Data + "'", Status.PASS);
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] count does not match '" + Data + "'. Actual count is +'" + elementCount + "'");
    }
}

assertElementCSSMatches

Description: This function will assert if the Element has the expected CSS attribute

Input Format : CSS Name=CSS Value

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementCSSMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementCSSMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementCSSMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has the CSS [<Data>]", input = InputType.YES)
public void assertElementCSSMatches() {
    String attributeName = Data.split("=", 2)[0];
    String attributeValue = Data.split("=", 2)[1];
    String value = "";
    try {
        LocatorAssertions.HasCSSOptions options = new LocatorAssertions.HasCSSOptions();
        options.setTimeout(getTimeoutValue());
        value = (String) Locator.evaluate("(element) => window.getComputedStyle(element).getPropertyValue('" + attributeName + "')");
        highlightElement();
        assertThat(Locator).hasCSS(attributeName, attributeValue, options);
        Report.updateTestLog(Action, "[" + ObjectName + "] has CSS attribute '" + attributeName + "' with value '" + attributeValue + "'", Status.PASS);
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have CSS attribute '" + attributeName + "' with value '" + attributeValue + "'. Actual value is '" + value + "'");
    } finally {
        removeHighlightFromElement();
    }
}

assertElementIdMatches

Description: This function will assert if the Element has the expected ID

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIdMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIdMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIdMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has ID [<Data>]", input = InputType.YES)
public void assertElementIdMatches() {
    String actualIdValue = "";
    try {
        LocatorAssertions.HasIdOptions options = new LocatorAssertions.HasIdOptions();
        options.setTimeout(getTimeoutValue());         
        assertThat(Locator).hasId(Pattern.compile(Data),options);
        actualIdValue = Locator.getAttribute("id");
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] has 'ID' matching '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have 'ID' matching '" + Data + "'. Actual value is '" + actualIdValue + "'");
    }
}

assertElementJSPropertyMatches

Description: This function will assert if the Element has the expected JS Property attribute

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementJSPropertyMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementJSPropertyMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementJSPropertyMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

    @Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has JS Property [<Data>]", input = InputType.YES)
        public void assertElementJSPropertyMatches() {
            String attributeName = Data.split("=")[0];
            String attributeValue = Data.split("=")[1];
            try {
                LocatorAssertions.HasJSPropertyOptions options = new LocatorAssertions.HasJSPropertyOptions();
                options.setTimeout(getTimeoutValue());        
                assertThat(Locator).hasJSProperty(attributeName, attributeValue, options);
                highlightElement();
                Report.updateTestLog(Action, "[" + ObjectName + "] has JS Property attribute '" + attributeName + "' with value '" + attributeValue + "'", Status.PASS);
                removeHighlightFromElement();
            } catch (PlaywrightException e) {
                PlaywrightExceptionLogging(e);
            } catch (AssertionFailedError err) {
                assertionLogging(err, "[" + ObjectName + "] does not have JS Property attribute '" + attributeName + "' with value '" + attributeValue + "'");
            }
        }

assertElementRoleMatches

Description: This function will assert if the Element's Role matches the expected value

Input Format : @Expected Role Value

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementRoleMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementRoleMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementRoleMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has Role [<Data>]", input = InputType.YES)
public void assertElementRoleMatches() {
    String actualIdValue = "";
    try {
        LocatorAssertions.HasRoleOptions options = new LocatorAssertions.HasRoleOptions();
        options.setTimeout(getTimeoutValue());         
        assertThat(Locator).hasRole(AriaRole.valueOf(Data.toUpperCase()),options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] has 'Role' matching '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have 'Role' matching '" + Data + "'. Actual value is '" + actualIdValue + "'");
    }
}

assertElementTextMatches

Description: This function will assert if the Element's text matches the expected text

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementTextMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementTextMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementTextMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has text [<Data>]", input = InputType.YES)
public void assertElementTextMatches() {
    String text = "";
    try {
        LocatorAssertions.HasTextOptions options = new LocatorAssertions.HasTextOptions();
        options.setTimeout(getTimeoutValue());      
        assertThat(Locator).hasText(Pattern.compile(Data),options);
        text = Locator.textContent();
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] has text '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have text '" + Data + "'. Actual text is '" + text + "'");
    }
}

assertElementValueMatches

Description: This function will assert if the Element's value contains the expected value.

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementValueMatches @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementValueMatches Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementValueMatches %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has value [<Data>]", input = InputType.YES)
public void assertElementValueMatches() {

    String value = "";
    try {
        LocatorAssertions.HasValueOptions options = new LocatorAssertions.HasValueOptions();
        options.setTimeout(getTimeoutValue());      
        assertThat(Locator).hasValue(Pattern.compile(Data),options);
        value = Locator.getAttribute("value");
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] has value '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have value '" + Data + "'. Actual value is '" + value + "'");
    }
}

assertElementValuesMatch

Description: This function will assert if the Element's values contains the expected values

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementValuesMatch @value optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementValuesMatch Sheet:Column optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementValuesMatch %dynamicVar% optional timeout (in ms) PageName ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] has values [<Data>]", input = InputType.YES)
public void assertElementValuesMatch() {
    try {
        LocatorAssertions.HasValuesOptions options = new LocatorAssertions.HasValuesOptions();
        options.setTimeout(getTimeoutValue()); 
        String values[] = Data.split("=");
        Pattern[] pattern = new Pattern[values.length];
        for (int i = 0; i < values.length; i++) {
            pattern[i] = Pattern.compile(values[i]);
        }
        assertThat(Locator).hasValues(pattern,options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] has values '" + Data + "'", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] does not have values '" + Data + "'");
    }
}

assertElementIsAttached

Description: This function will assert if the Element is attached to the DOM

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsAttached optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsAttached optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsAttached optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] points to an attached DOM node")
public void assertElementIsAttached() {
    try {
        LocatorAssertions.IsAttachedOptions options = new LocatorAssertions.IsAttachedOptions();
        options.setTimeout(getTimeoutValue()); 
        assertThat(Locator).isAttached(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is attached to the DOM", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not attached to the DOM");
    }
}

assertElementIsChecked

Description: This function will assert if the Element is checked.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsChecked optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsChecked optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsChecked optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is checked")
public void assertElementIsChecked() {
    try {
        LocatorAssertions.IsCheckedOptions options = new LocatorAssertions.IsCheckedOptions();
        options.setTimeout(getTimeoutValue()); 
        assertThat(Locator).isChecked(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is checked", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not checked");
    }
}

assertElementIsDisabled

Description: This function will assert if the Element is disabled.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsDisabled optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsDisabled optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsDisabled optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is disabled")
public void assertElementIsDisabled() {
    try {
        LocatorAssertions.IsDisabledOptions options = new LocatorAssertions.IsDisabledOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).isDisabled(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is disabled", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not disabled");
    }
}

assertElementIsEditable

Description: This function will assert if the Element is editable.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsEditable optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsEditable optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsEditable optional timeout (in ms) PageName ⬅ Input from variable
    @Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is editable")
public void assertElementIsEditable() {
    try {
        LocatorAssertions.IsEditableOptions options = new LocatorAssertions.IsEditableOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).isEditable(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is editable", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not editable");
    }
}

assertElementIsEmpty

Description: This function will assert if the Element is empty.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsEmpty optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsEmpty optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsEmpty optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is empty")
public void assertElementIsEmpty() {
    try {
        LocatorAssertions.IsEmptyOptions options = new LocatorAssertions.IsEmptyOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).isEmpty(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is empty", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not empty");
    }
}

assertElementIsEnabled

Description: This function will assert if the Element is enabled.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsEnabled optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsEnabled optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsEnabled optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is enabled")
public void assertElementIsEnabled() {
    try {
        LocatorAssertions.IsEnabledOptions options = new LocatorAssertions.IsEnabledOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).isEnabled(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is enabled", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not enabled");
    }
}

assertElementIsFocused

Description: This function will assert if the Element is focused.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsFocused optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsFocused optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsFocused optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is focused")
public void assertElementIsFocused() {
    try {
        LocatorAssertions.IsFocusedOptions options = new LocatorAssertions.IsFocusedOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).isFocused(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is focused", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not focused");
    }
}

assertElementIsHidden

Description: This function will assert if the Element is hidden.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsHidden optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsHidden optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsHidden optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is hidden")
public void assertElementIsHidden() {
    try {
        LocatorAssertions.IsHiddenOptions options = new LocatorAssertions.IsHiddenOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Locator).isHidden(options);
        Report.updateTestLog(Action, "[" + ObjectName + "] is hidden", Status.PASS);
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not hidden");
    }
}

assertElementIsInViewport

Description: This function will assert if the Element is in viewport.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsInViewport optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsInViewport optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsInViewport optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is in viewport")
public void assertElementIsInViewport() {
    try {
        LocatorAssertions.IsInViewportOptions options = new LocatorAssertions.IsInViewportOptions();
        options.setTimeout(getTimeoutValue()); 
        assertThat(Locator).isInViewport(options);
        highlightElement();
        Report.updateTestLog(Action, "[" + ObjectName + "] is in viewport", Status.PASS);
        removeHighlightFromElement();
    } catch (PlaywrightException e) {
        PlaywrightExceptionLogging(e);
    } catch (AssertionFailedError err) {
        assertionLogging(err, "[" + ObjectName + "] is not in viewport");
    }
}

assertElementIsVisible

Description: This function will assert if the Element is visible.

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Object 🟢 assertElementIsVisible optional timeout (in ms) PageName ⬅ Hardcoded Input
Object 🟢 assertElementIsVisible optional timeout (in ms) PageName ⬅ Input from Datasheet
Object 🟢 assertElementIsVisible optional timeout (in ms) PageName ⬅ Input from variable
@Action(object = ObjectType.PLAYWRIGHT, desc = "Assert if [<Object>] is visible")
    public void assertElementIsVisible() {
        try {
            LocatorAssertions.IsVisibleOptions options = new LocatorAssertions.IsVisibleOptions();
            options.setTimeout(getTimeoutValue());              
            assertThat(Locator).isVisible(options);
            highlightElement();
            Report.updateTestLog(Action, "[" + ObjectName + "] is visible", Status.PASS);
            removeHighlightFromElement();
        } catch (PlaywrightException e) {
            PlaywrightExceptionLogging(e);
        } catch (AssertionFailedError err) {
            assertionLogging(err, "[" + ObjectName + "] is not visible");
        }
    }

assertPageTitleMatches

Description: This function will assert the Page Title.

Input Format : @Expected Text

Condition Format : (Optional) Timeout Value (in ms)

ObjectName Action Input Condition
(Optional)
Reference
Browser 🟢 assertPageTitleMatches @value optional timeout (in ms) ⬅ Hardcoded Input
Browser 🟢 assertPageTitleMatches Sheet:Column optional timeout (in ms) ⬅ Input from Datasheet
Browser 🟢 assertPageTitleMatches %dynamicVar% optional timeout (in ms) ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

@Action(object = ObjectType.BROWSER, desc = "Assert if Page has title [<Data>]", input = InputType.YES)
public void assertPageTitleMatches() {

    try {
        PageAssertions.HasTitleOptions options = new PageAssertions.HasTitleOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Page).hasTitle(Pattern.compile(Data), options);
        Report.updateTestLog(Action, "Page has title matching '" + Data + "'", Status.PASS);
    } catch (AssertionFailedError e) {
        Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
        Report.updateTestLog("Assertion Failed", "Page does not have title matching '" + Data + "'", Status.FAIL);
    } catch (PlaywrightException e) {
        throw new ActionException(e);
    }
}

assertPageURLMatches

Description: This action asserts that the current page URL matches the expected pattern. The assertion supports both exact URL matching and regex pattern matching, making it flexible for validating navigation and page state.

Input Format : @Expected URL or Regex Pattern

Condition Format : (Optional) Timeout Value (in ms)

Pattern Matching

The input is treated as a regex pattern. For exact URL matching, ensure special regex characters (like ., ?, =, &) are properly escaped. For flexible matching, use regex patterns like .*, \\d+, etc.

Common Use Cases

  • Verify successful navigation to a specific page
  • Validate dynamic URLs with query parameters
  • Check URL patterns after login or form submission
  • Confirm correct routing in single-page applications
ObjectName Action Input Condition
(Optional)
Reference
Browser 🟢 assertPageURLMatches @value optional timeout (in ms) ⬅ Hardcoded Input
Browser 🟢 assertPageURLMatches Sheet:Column optional timeout (in ms) ⬅ Input from Datasheet
Browser 🟢 assertPageURLMatches %dynamicVar% optional timeout (in ms) ⬅ Input from variable

Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the datasheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.

Example 1: Exact URL Match

Verify the page navigated to the exact inventory URL:

ObjectName Action Input Condition Reference
Browser assertPageURLMatches @https://www\.saucedemo\.com/inventory\.html

Note

Special characters like . need to be escaped with \\ for exact matching.

Example 2: Pattern Matching with Query Parameters

Verify URL contains specific path and accepts any query parameters:

ObjectName Action Input Condition Reference
Browser assertPageURLMatches @https://example\.com/search\?.product.

Example 3: Dynamic URL with ID

Verify URL pattern for product page with any numeric ID:

ObjectName Action Input Condition Reference
Browser assertPageURLMatches @https://example\.com/product/\d+

Example 4: With Timeout

Assert URL match with custom timeout of 10 seconds:

ObjectName Action Input Condition Reference
Browser assertPageURLMatches @https://www\.saucedemo\.com/inventory\.html 10000

Example 5: Using Variable

Assert URL using a previously stored variable:

ObjectName Action Input Condition Reference
Browser assertPageURLMatches %expectedURL%
@Action(object = ObjectType.BROWSER, desc = "Assert if Page has URL [<Data>]", input = InputType.YES)
public void assertPageURLMatches() {

    try {
        PageAssertions.HasURLOptions options = new PageAssertions.HasURLOptions();
        options.setTimeout(getTimeoutValue());
        assertThat(Page).hasURL(Pattern.compile(Data), options);
        Report.updateTestLog(Action, "Page has URL matching '" + Data + "'", Status.PASS);
    } catch (AssertionFailedError e) {
        Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
        Report.updateTestLog("Assertion Failed", "Page does not have URL matching '" + Data + "'", Status.FAIL);
    } catch (PlaywrightException e) {
        throw new ActionException(e);
    }
}