Get the css value of an web element using selenium

GUI testing is the basic validation we do mostly in browser applications…
this may be the text font, text size, text color, background color, placements like margin / padding,
These all above attributes for a web element, mostly we combine it in a file called *.css

Selenium has the flexibility to get the css styling of a particular web element, so we can compare the same thing in different browsers to make sure it is same everywhere.

Let’s see how we can get the css style of a web element.

For an example, let’s take a text box with the following css values and then we will get their values using code:

OutPut:

Note: Font Weight 700 means Bold text

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: