* Check if element exists in DOM * @returns {Promise } True if element exists
()
| 175 | * @returns {Promise<boolean>} True if element exists |
| 176 | */ |
| 177 | async exists() { |
| 178 | try { |
| 179 | switch (this.helperType) { |
| 180 | case 'playwright': |
| 181 | // For Playwright, if we have the element, it exists |
| 182 | return await this.element.evaluate(el => !!el) |
| 183 | case 'webdriver': |
| 184 | // For WebDriver, if we have the element, it exists |
| 185 | return true |
| 186 | case 'puppeteer': |
| 187 | // For Puppeteer, if we have the element, it exists |
| 188 | return await this.element.evaluate(el => !!el) |
| 189 | default: |
| 190 | throw new Error(`Unsupported helper type: ${this.helperType}`) |
| 191 | } |
| 192 | } catch (e) { |
| 193 | return false |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Get bounding box of the element |
no test coverage detected