サイズを取得
DOM要素の幅と高さを取得します。
使用方法
$(selector).getSize(prop)
パラメータ
名前 | タイプ | 詳細 |
---|---|---|
prop オプション | 文字列 | 取得するサイズ [オプション] ("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
})