How to get the style of an element in Selenium

Java

In Java, the WebElement has a getCssValue() method.

String display = driver.findElement(By.id("myID")).getCssValue("display");

Python

In Python, the WebElement has a value_of_css_property() method.

display = driver.find_element_by_id("MyID")).value_of_css_property("display")

C#

In C#, the IWebElement has a GetCSSValue() method.

string display = driver.FindElement(By.Id("myID")).GetCssValue("display");