Robot Framework With Playwright Library (contains)

I am migrating our Robot framework tests from Selenium library onto Playwright library. And i am stuck in one message validation of a text message which contains unique incident ID every time, so while validating the success message i want to ignore the incident ID part but need to validate the rest of the text. So for this purpose in selenium i was using “Should Contain” which was working fine but for Playwright i tried using “contains” as well as “*=” but it is not working as expected. Here is what i am doing:

${Text} = This is success message

${SuccessfulMessage} Browser.Get Text ${Locator} contains ${Text}

When i do Log ${SuccessfulMessage} it is giving me This is success message 11-222-333
Probably because when i doing Browser.Get Text ${Locator} , it is fetching the whole text message with incident ID and comparing the same with ${Text}, and getting failed.

How can i resolve this ? I can provide you all other details if required.

@naveen09 The line

${SuccessfulMessage} Browser.Get Text ${Locator} contains ${Text}

already contains a assertion: contains ${Text}

The following example verifies if the banner class of the website robotframework.org contains the text “ROBOT”

Test
    New Browser    chromium    headless=false
    New Page    https://robotframework.org/
    Get Text    css=.banner    contains    ROBOT
2 Likes