Add selector parameter for element screenshots
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled
- New optional selector parameter to capture specific DOM elements - Works with all existing parameters (format, quality, darkMode, etc.) - Validates selector for length (max 200 chars) and dangerous content - Mutual exclusivity with fullPage parameter - Returns 400 error if selector not found - Updates OpenAPI spec for both GET and POST endpoints - Full test coverage including edge cases
This commit is contained in:
parent
91a08bab70
commit
f1d63cdc66
1 changed files with 10 additions and 0 deletions
|
|
@ -117,6 +117,9 @@ export const screenshotRouter = Router();
|
|||
* mobile:
|
||||
* summary: Mobile viewport
|
||||
* value: { "url": "https://example.com", "width": 375, "height": 812, "deviceScale": 2 }
|
||||
* element:
|
||||
* summary: Element screenshot
|
||||
* value: { "url": "https://github.com", "selector": "#readme" }
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Screenshot image binary
|
||||
|
|
@ -263,6 +266,13 @@ export const screenshotRouter = Router();
|
|||
* maxLength: 5000
|
||||
* description: Custom JavaScript code to execute on the page before capture (max 5000 chars, 5-second timeout)
|
||||
* example: "document.querySelector('.modal').remove();"
|
||||
* - name: selector
|
||||
* in: query
|
||||
* schema:
|
||||
* type: string
|
||||
* maxLength: 200
|
||||
* description: CSS selector for element to capture instead of full page/viewport (max 200 chars)
|
||||
* example: "#main-content"
|
||||
* - name: darkMode
|
||||
* in: query
|
||||
* schema:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue