Menu
WebdriverIODocsAPIHelpVersionsContributeGitHub
WebdriverIO
  • Docs
  • API
  • Help
  • Versions
  • Contribute
  • GitHub
  • Introduction
    • API Docs
  • Protocols
    • Webdriver Protocol
    • Appium
    • JSON Wire Protocol
    • Mobile JSON Wire Protocol
    • Chromium
    • Sauce Labs
    • Selenium Standalone
  • Testrunner
    • Expect
  • browser
    • $$
    • $
    • call
    • custom$$
    • custom$
    • debug
    • deleteCookies
    • execute
    • executeAsync
    • getCookies
    • getWindowSize
    • keys
    • newWindow
    • pause
    • react$$
    • react$
    • reloadSession
    • saveRecordingScreen
    • saveScreenshot
    • setCookies
    • setTimeout
    • setWindowSize
    • switchWindow
    • touchAction
    • uploadFile
    • url
    • waitUntil
  • element
    • $$
    • $
    • addValue
    • clearValue
    • click
    • custom$$
    • custom$
    • doubleClick
    • dragAndDrop
    • getAttribute
    • getCSSProperty
    • getHTML
    • getLocation
    • getProperty
    • getSize
    • getTagName
    • getText
    • getValue
    • isClickable
    • isDisplayed
    • isDisplayedInViewport
    • isEnabled
    • isEqual
    • isExisting
    • isFocused
    • isSelected
    • moveTo
    • react$$
    • react$
    • saveScreenshot
    • scrollIntoView
    • selectByAttribute
    • selectByIndex
    • selectByVisibleText
    • setValue
    • shadow$$
    • shadow$
    • touchAction
    • waitForClickable
    • waitForDisplayed
    • waitForEnabled
    • waitForExist
    • waitUntil

getSize

Get the width and height for an DOM-element.

Usage#
$(selector).getSize({ })
Parameters#
NameTypeDetails
prop
optional
Stringsize to receive [optional] ("width" or "height")
Example#
it('should demonstrate the getSize command', () => {
browser.url('http://github.com')
const logo = $('.octicon-mark-github')
const size = logo.getSize()
console.log(size) // outputs: { width: 32, height: 32 }
const width = logo.getSize('width')
console.log(width) // outputs: 32
const height = logo.getSize('height')
console.log(height) // outputs: 32
})
Edit this page
Previous
« getProperty
Next
getTagName »

Community

  • Twitter
Copyright © 2020 OpenJS Foundation