Ask a Question

Edited cell turns to a different color, how to automate this?

Occasional Contributor

Edited cell turns to a different color, how to automate this?


I am working on an electron application. I have a cell which when edited turns green(bg color) colour for 3 seconds and goes back to original bg colour which is black. How do I automate this scenario using Test Complete.

Community Hero

I would think there would be some kind of property on the object you could chec, but without more information I'm not sure.


That said this is a visual / appearance test which doesn't really make sense to automate IMHO.


Click the Accept as Solution button if my answer has helped

Look at WaitProperty("propertyname", "value", time to wait in milliseconds)


In your case, you will be waiting for the bgcolor of the textbox to be red or green and wait for whatever amount of time that usually takes.


Mytextbox.WaitProperty("bgcolor", "red", 30000);


Hope that makes sense



SmartBear Alumni (Retired)

Thanks for the help, @LinoTadros@cunderw.


@jerkins, did the suggestions help you? Is there any solution you can share with us?

Tanya Yatskovskaya
SmartBear Community and Education Manager

Occasional Contributor

Thanks!! That worked like a charm!


Old code never dies. I posted this on the forum years ago. For those that test objects that do not have the color properties there is a way to check an individual pixel of any object on the desktop. The code is VBscript. You can format the output to suit your needs.


Function Return_RGB(objWindowType, nvXcoord, nvYcoord)

'* FUNCTION: Return_RGB(objWindowType As Object, nvXcoord As Long, nvYcoord As Long)
'* PURPOSE: To return a RGB set of values that is the color of the X, Y coordinate of the Window Object
'* EXAMPLE: Return_RGB(Sys.Process("MyProcess").VCLObject("frmMain"), 10, 10)      ' Normal Window object
'* The example returns the RGB color of the pixel at the 10,10 coordinate of the VCLObject("frmMain").
'* The return value is a string that would look like >>> 255,26,0
'* The '255' is the Red value. 1st position
'* The '26' is the Green value. 2nd position
'* The '0' is the Blue value. 3rd position
Dim tPOS, dcWindow, nvRGB, svTemp
Dim lRed, lGreen, lBlue


If objWindowType.Exists = True Then

    ' Move to the X, Y coordinate
    objWindowType.HoverMouse nvXcoord, nvYcoord

    ' Get the dc of a specific hwnd - the desktop
    dcWindow = Win32API.GetWindowDC(0)

    ' Get the cursor position relative to the screen.
    tPOS.y = objWindowType.ScreenTop + nvYcoord
    tPOS.x = objWindowType.ScreenLeft + nvXcoord

    ' Use GetPixel() with the appropriate DC and location
    nvRGB = Win32API.GetPixel(dcWindow, tPOS.x, tPOS.y)

    ' HEX to string
    svTemp = Right("000000" & Hex(nvRGB), 6)

    ' Parse out the individual values
    lRed = CLng("&H" & Right(svTemp, 2))
    lGreen = CLng("&H" & Mid(svTemp, 3, 2))
    lBlue = CLng("&H" & Left(svTemp, 2))

    Return_RGB = CStr(lRed) & "," & CStr(lGreen) & "," & CStr(lBlue) 'Return the RGB values here

    Return_RGB = "NO COLOR FOUND"
    Log.Warning "Return_RGB - NO COLOR FOUND - Object did not exist - Window to check= " & objWindowType.Name, "", pmNormal,        LogAttributes(0), Sys.Desktop
End If

End Function


Showing results for 
Search instead for 
Did you mean: