* {{> saveElementScreenshot }}
(locator, fileName)
| 2203 | * {{> saveElementScreenshot }} |
| 2204 | */ |
| 2205 | async saveElementScreenshot(locator, fileName) { |
| 2206 | const outputFile = screenshotOutputFolder(fileName) |
| 2207 | |
| 2208 | const res = await this._locate(locator) |
| 2209 | assertElementExists(res, locator) |
| 2210 | if (res.length > 1) this.debug(`[Elements] Using first element out of ${res.length}`) |
| 2211 | const elem = res[0] |
| 2212 | this.debug(`Screenshot of ${new Locator(locator)} element has been saved to ${outputFile}`) |
| 2213 | return elem.screenshot({ path: outputFile, type: 'png' }) |
| 2214 | } |
| 2215 | |
| 2216 | /** |
| 2217 | * {{> saveScreenshot }} |
no test coverage detected