如何检索元素的clientWidth
and scrollWidth
?使用getCssValue
不起作用
$('.grid-header-col .title').getCssValue('scrollWidth')
如何检索元素的clientWidth
and scrollWidth
?使用getCssValue
不起作用
$('.grid-header-col .title').getCssValue('scrollWidth')
您应该getAttribute()
改用:
element(by.css('.grid-header-col .title')).getAttribute('scrollWidth');
Both scrollWidth and clientWidth are properties of DOM element. So you need to get the dom element first by attaching [0] after a jquery object and then retreive the properties.
$('.grid-header-col .title')[0].scrollWidth
$('.grid-header-col .title')[0].clientWidth