testingautomated-testsbackground-colorkatalon-recorder

Verify color in Katalon Recorder


Hi,

I would like to check that the color of a button is the expected color. I don’t know exactly which command I have to use in Katalon Recorder.

Here my element:

<ux-badge typeclass="success" class="ng-star-inserted">
<span class="ux-badge ux-badge--success ux-badge--pill ux-badge--small" data-e2e="ux-badge">Open</span>
</ux-badge>

Here my css style:

ux-badge--success {
    background-color: rgb(70, 122, 57);
}

Could you please help me with that ?

Thanks in advance for your help


Solution

  • I found the solution:

    Step 1: Create a variable

    Command:storeEval

    Target: getComputedStyle(document.querySelector(".ux-badge--success")).backgroundColor

    Value: background

    Step 2: Evaluate the variable

    Command:assertEval

    Target: "${background}" == "rgb(70, 122, 57)"

    Value: true