1
如何检索元素的clientWidth
和scrollWidth
?使用getCssValue
不起作用访问元素值
$('.grid-header-col .title').getCssValue('scrollWidth')
如何检索元素的clientWidth
和scrollWidth
?使用getCssValue
不起作用访问元素值
$('.grid-header-col .title').getCssValue('scrollWidth')
您应该使用getAttribute()
代替:
element(by.css('.grid-header-col .title')).getAttribute('scrollWidth');
两个scrollWidth和clientWidth是DOM元素的属性。所以你需要首先获得dom元素,在jquery对象之后附加[0],然后检索属性。
$('.grid-header-col .title')[0].scrollWidth
$('.grid-header-col .title')[0].clientWidth