メインコンテンツにスキップ

サイズを取得

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
})

ようこそ!何かお困りですか?

WebdriverIO AI Copilot