* Performs click at specific coordinates. * If locator is provided, the coordinates are relative to the element. * If locator is not provided, the coordinates are global page coordinates. * * ```js * // Click at global coordinates (100, 200) * I.clickXY(100, 200); * * // Clic
(locator, x, y)
| 2121 | * @returns {Promise<void>} |
| 2122 | */ |
| 2123 | async clickXY(locator, x, y) { |
| 2124 | // If locator is a number, treat it as global X coordinate |
| 2125 | if (typeof locator === 'number') { |
| 2126 | const globalX = locator |
| 2127 | const globalY = x |
| 2128 | await this.page.mouse.click(globalX, globalY) |
| 2129 | return this._waitForAction() |
| 2130 | } |
| 2131 | |
| 2132 | // Locator is provided, click relative to element |
| 2133 | const el = await this._locateElement(locator) |
| 2134 | assertElementExists(el, locator, 'Element to click') |
| 2135 | |
| 2136 | const box = await el.boundingBox() |
| 2137 | if (!box) { |
| 2138 | throw new Error(`Element ${locator} is not visible or has no bounding box`) |
| 2139 | } |
| 2140 | |
| 2141 | const absoluteX = box.x + x |
| 2142 | const absoluteY = box.y + y |
| 2143 | |
| 2144 | await this.page.mouse.click(absoluteX, absoluteY) |
| 2145 | return this._waitForAction() |
| 2146 | } |
| 2147 | |
| 2148 | /** |
| 2149 | * |
nothing calls this directly
no test coverage detected