मुख्य सामग्री पर जाएं

गेटसाइज़

एक 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> }) या वास्तविक चौड़ाई/ऊंचाई संख्या के रूप में यदि प्रॉप पैरामीटर दिया गया है

Welcome! How can I help?

WebdriverIO AI Copilot