webdriverio
Version:
Next-gen browser and mobile automation test framework for Node.js
32 lines (29 loc) • 1.18 kB
TypeScript
import type { RectReturn } from '@wdio/protocols';
export type Size = Pick<RectReturn, 'width' | 'height'>;
/**
*
* Get the width and height for an DOM-element.
*
* <example>
: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
})
* </example>
*
* @alias element.getElementSize
* @param {String=} prop size to receive [optional] ("width" or "height")
* @return {Object|Number} requested element size (`{ width: <Number>, height: <Number> }`) or actual width/height as number if prop param is given
* @type property
*
*/
export declare function getSize(this: WebdriverIO.Element): Promise<Size>;
export declare function getSize(this: WebdriverIO.Element, prop: keyof RectReturn): Promise<number>;
//# sourceMappingURL=getSize.d.ts.map