Unfortunately,
this is not possible using the native Selenium API.
But with Javascript you can:
You can use some javascript support using Seleniums functionality JavascriptExecutor.executeScript.
js ( @Mahsum Akbas)
Java/Selenium, "css-attribute01: value01; css-attribute02: value02;".
, css- .
WebElement we = driver.findElement(By.tagName("div"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
String script = "var s = '';" +
"var o = getComputedStyle(arguments[0]);" +
"for(var i = 0; i < o.length; i++){" +
"s+=o[i] + ':' + o.getPropertyValue(o[i])+';';}" +
"return s;";
System.out.println(executor.executeScript(script, we));
script . , , . .
Update
, "" Selenium, @JeffC:
driver.findElement(By.tagName("div")).getAttribute("style")
:
" " CSS-, . , .