Styrow.dev
Question 24 of 64

How to retrieve CSS properties of an element?

Question

How to retrieve CSS properties of an element?

Answer

The values of the css properties can be retrieved using a get() method:

Syntax:

driver.findElement(By.id(“id”)).getCssValue(“name of css attribute”);

driver.findElement(By.id(“id”)).getCssValue(“font-size”);