getSize
DOM要素の幅と高さを取得します。
使用方法
$(selector).getSize(prop)
パラメータ
名前 | 型 | 詳細 |
---|---|---|
prop オプション | String | 取得するサイズ [オプション] ("width"または"height") |
例
getSize.js
it('should demonstrate the getSize command', async () => {
await browser.url('http://github.com')
const logo = await $('.octicon-mark-github')
const size = await logo.getSize()
console.log(size) // outputs: { width: 32, height: 32 }
const width = await logo.getSize('width')
console.log(width) // outputs: 32
const height = await logo.getSize('height')
console.log(height) // outputs: 32
})
戻り値
- <Object|Number>
return
: 要求された要素のサイズ ({ width: <Number>, height: <Number> }
) または、propパラメータが指定された場合は実際の幅/高さを数値で返します