Forum Discussion

TanIlak's avatar
TanIlak
Contributor
2 years ago

verify color of text and textbox

Hi all,

Here when the page loaded am trying to verify the search field that displays grey color and text as "search Amazon.in"

After entering text or click it changed as orange

How to verify the color changes???

Here the attachment

 

 

  • If inline style does not work, then try computed style.

     

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If inline style does not work, then try computed style.

     

     

    • TanIlak's avatar
      TanIlak
      Contributor

      Thank you rraghvani

      Inline style not worked, As you said computed style is working.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    It is possible to write a function and print the actual values of,

     

    rgb(255, 0, 0) = Red

    rgb(0, 255, 0) = Green

    rgb(0, 0, 255) = Blue

     

    If you search the internet, you will come across examples.

    • TanIlak's avatar
      TanIlak
      Contributor

      var fontColor=page.FindElement();

      Log.Message(fontColor.style.color);

       

      >> Empty log file only printing

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You have not provided any parameters for FindElement, so how will TC know what object you are referring to?

     

    I suggest you use your browsers' development tool to see exactly what styling are being used. You should then be able to use this in TC.

    • TanIlak's avatar
      TanIlak
      Contributor

      I forgot to add parameter in my last reply

       

      var fontColor=page.FindElement(xpath);

      Log.Message(fontColor.style.color);

       

      xpath contains===< div class=" *attributevalue * " >