I am trying to verify whether text is bold or not, within a free text area. When I select the element, I cannot verify the text part.
I have tried using .getCSSValues as per the duplicate link suggestion but it doesn't work as it doesn't get the 'text' of that freetext area, which is a string. The freetext area is an element.
IWebElement isBold = _driver.FindElement(By.TagName("p"));
isBold.GetCssValue("font-weight");
But the font weight returns "400" regardless of whether the text is bold or not.
The HTML is
<div class="fr-element fr-view" dir="auto" contenteditable="true" aria-disabled="false" spellcheck="true"><p style=""><strong>TEXT</strong></p></div>
I would expect the selected text to be "700" when it is bold.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…