Issue
I have a pdf document like this:
\<div class=**"cs6C976429"** style="width:671px;height:18px;line-height:17px;margin-top:98px;margin-left:94px;position:absolute;text-align:left;vertical-align:top;"\>
\<nobr\>INFORMATIONBOLD\</nobr\>\</div\>
\<style type="text/css"\>
.cs85480F5E {color:#000000 !important;background-color:transparent !important;border-left-style: none !important;border-top-style: none !important;border-right-style: none !important;border-bottom-style: none !important;font-family:'Times New Roman' !important; font-size:13px !important; font-weight:normal !important; font-style:normal !important; !important;}
.cs8B56BD64 {color:#000000 !important;background-color:transparent !important;border-left-style: none !important;border-top-style: none !important;border-right-style: none !important;border-bottom-style: none !important;font-family:'Times New Roman' !important; font-size:15px !important; font-weight:bold !important; font-style:normal !important; !important;}
**.cs6C976429** {color:#000000 !important;background-color:transparent !important;border-left-style: none !important;border-top-style: none !important;border-right-style: none !important;border-bottom-style: none !important;font-family:'Times New Roman' !important; font-size:15px !important; **font-weight:bold** !important; font-style:normal !important; padding-left:2px !important;}
.cs354AAA62 {color:#808080 !important;background-color:transparent !important;border-left-style: none !important;border-top-style: none !important;border-right-style: none !important;border-bottom-style: none !important;font-family:'Times New Roman' !important; font-size:16px !important; font-weight:bold !important; font-style:normal !important; padding-left:2px !important;padding-right:2px !important;}
\</style\>
I have to validate the INFORMATIONBOLD is in bold style by selenium, I found the style with the Xpath selector:
\//style\[@type='text/css'\]
I am not able to find a way to validate the specific class used before is with the bold style with Selenium C#
Solution
Algorithm: I can only give you an algorithm as am not a c#
person.
- Identify and store the desired element into a variable. You may probably use one of the below XPath expression to locate the element
//div[text()='INFORMATIONBOLD']
or:
//nobr[text()='INFORMATIONBOLD']
- Store the font-weight CSS value into a variable as below
var fontWeight = webelement.GetCssValue("font-weight");
- if fontWeight is greater than or equal to 700 THEN "Its bold"
- Else "its not bold"
Answered By - Shawn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.