Home > database >  VB.net 2019 Selenium Unable to Get the Font Color of the Element
VB.net 2019 Selenium Unable to Get the Font Color of the Element

Time:11-11

I have a web elements as follows

<td>01 Jan 1950</td>
<td>
  <font class="redtext">06 Sep 1933</font>
</td>

I am trying to get the font color using VB statement

Try
   Dim redfont = td.FindElements(By.ClassName("redtext"))
Catch ex As Exception
End Try

The return value in redfont if the element has tag is a string "rgba(0,0,0,1)" and am not able to test for color vbRed.

What I want is to get the font color of innertext, and if it is red then do some actions else Ignore. How Do I get the font color of innertext of ?

CodePudding user response:

Got it with few experiments.... Although this is not the correct way to do it, but works for me. The original issue of getting the font color of the innertext and testing it is still pending for me.

Try
   Dim redfont = td.FindElement(By.TagName("font"))
   '<My ToDo Statements>
Catch ex As Exception
    '<My ToDo Statements when Exception is Caught>
End Try
       
  • Related