Styrow.dev
Question 24 of 82

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”);


📲 Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.