2015-04-22 11 views
0

我是量角器的新手,我想檢查一些CSS屬性。我這樣做(CoffeeScript):量角器:使用getCssValue檢查邊界半徑

element.all(By.css(".my-picture")).then (pictures) -> 
    for picture in pictures 
     picture.getCssValue("border-radius").then (value) -> 
     console.log value 

上述代碼不會打印任何內容。我可以得到像「顯示」或「顏色」的屬性,但沒有「邊界半徑」。

根據this documentation,似乎getCssValue只適用於CSS2規範。而根據CSS2Properties docborder-radius不存在!

現在,我意識到border-radius是一個CSS3屬性。但問題仍然存在,我如何使用量角器對其進行測試?

+0

可以在這裏得到屬性幫助! –

回答

2
element.all(by.css('.my-picture')).then(function (pictures) { 
    for (picture in pictures) { 
     browser.executeScript(function (domPicture) { 
      var style = window.getComputedStyle(domPicture); 
      return style.getPropertyValue('border-radius'); 
     }, picture.getWebElement()).then(function (borderRadius) { 
      console.log(borderRadius); 
     }); 
    } 
});