Trying to get background color



  • When I'm trying to get bgcolor using xpath I'm not getting the actual color.

    HTML Code

       <div class="__title">Preferred 2:1 </div>
    

    Selenium code:

    String bgColor=New_AEMLocators.marketingBanner.getCssValue("background-color");
    

    When I'm trying to print the bgColor,it printing rgba(0,0,0,0) But my bgcolor is white.

    The text "Preferred 2:1" is in black color. Somehow it's printing that in the console.

    Please help me in getting the exact bg color.

    Thanks in advance.



  • The CSS attribute for the text color is simply "color", not bgcolor.

    https://www.w3schools.com/cssref/pr_text_color.asp

    Inspect the "___titie" class to double check it.


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2