UNPKG

webdriverio

Version:

Next-gen browser and mobile automation test framework for Node.js

32 lines (30 loc) 1.29 kB
import type { RectReturn } from '@wdio/protocols'; export type Location = Pick<RectReturn, 'x' | 'y'>; /** * * Determine an element’s location on the page. The point (0, 0) refers to * the upper-left corner of the page. * * <example> :getLocation.js it('should demonstrate the getLocation function', async () => { await browser.url('http://github.com'); const logo = await $('.octicon-mark-github') const location = await logo.getLocation(); console.log(location); // outputs: { x: 150, y: 20 } const xLocation = await logo.getLocation('x') console.log(xLocation); // outputs: 150 const yLocation = await logo.getLocation('y') console.log(yLocation); // outputs: 20 }); * </example> * * @alias element.getLocation * @param {string} prop can be "x" or "y" to get a result value directly for easier assertions * @return {Object|Number} The X and Y coordinates for the element on the page `{x:number, y:number}` * @uses protocol/elementIdLocation * @type property */ export declare function getLocation(this: WebdriverIO.Element): Promise<Location>; export declare function getLocation(this: WebdriverIO.Element, prop: keyof Location): Promise<number>; //# sourceMappingURL=getLocation.d.ts.map