diff --git a/new-docs/puppeteer.page.emulatevisiondeficiency.md b/new-docs/puppeteer.page.emulatevisiondeficiency.md
index 2230df80..2fc46cd7 100644
--- a/new-docs/puppeteer.page.emulatevisiondeficiency.md
+++ b/new-docs/puppeteer.page.emulatevisiondeficiency.md
@@ -4,19 +4,46 @@
## Page.emulateVisionDeficiency() method
+Simulates the given vision deficiency on the page.
+
Signature:
```typescript
-emulateVisionDeficiency(type?: VisionDeficiency): Promise;
+emulateVisionDeficiency(type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']): Promise;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
-| type | VisionDeficiency | |
+| type | [Protocol.Emulation.SetEmulatedVisionDeficiencyRequest](./puppeteer.protocol.emulation.setemulatedvisiondeficiencyrequest.md)\['type'\] | the type of deficiency to simulate, or 'none'
to reset. |
Returns:
Promise<void>
+## Example
+
+
+```js
+const puppeteer = require('puppeteer');
+
+(async () => {
+ const browser = await puppeteer.launch();
+ const page = await browser.newPage();
+ await page.goto('https://v8.dev/blog/10-years');
+
+ await page.emulateVisionDeficiency('achromatopsia');
+ await page.screenshot({ path: 'achromatopsia.png' });
+
+ await page.emulateVisionDeficiency('deuteranopia');
+ await page.screenshot({ path: 'deuteranopia.png' });
+
+ await page.emulateVisionDeficiency('blurredVision');
+ await page.screenshot({ path: 'blurred-vision.png' });
+
+ await browser.close();
+})();
+
+```
+
diff --git a/new-docs/puppeteer.page.md b/new-docs/puppeteer.page.md
index de70a41e..6b23980d 100644
--- a/new-docs/puppeteer.page.md
+++ b/new-docs/puppeteer.page.md
@@ -92,7 +92,7 @@ page.off('request', logRequest);
| [emulateMediaFeatures(features)](./puppeteer.page.emulatemediafeatures.md) | | |
| [emulateMediaType(type)](./puppeteer.page.emulatemediatype.md) | | |
| [emulateTimezone(timezoneId)](./puppeteer.page.emulatetimezone.md) | | |
-| [emulateVisionDeficiency(type)](./puppeteer.page.emulatevisiondeficiency.md) | | |
+| [emulateVisionDeficiency(type)](./puppeteer.page.emulatevisiondeficiency.md) | | Simulates the given vision deficiency on the page. |
| [evaluate(pageFunction, args)](./puppeteer.page.evaluate.md) | | |
| [evaluateHandle(pageFunction, args)](./puppeteer.page.evaluatehandle.md) | | |
| [evaluateOnNewDocument(pageFunction, args)](./puppeteer.page.evaluateonnewdocument.md) | | |
diff --git a/src/common/Page.ts b/src/common/Page.ts
index 6370ab5c..4103862d 100644
--- a/src/common/Page.ts
+++ b/src/common/Page.ts
@@ -152,14 +152,6 @@ interface ScreenshotOptions {
encoding?: string;
}
-type VisionDeficiency =
- | 'none'
- | 'achromatopsia'
- | 'blurredVision'
- | 'deuteranopia'
- | 'protanopia'
- | 'tritanopia';
-
/**
* All the events that a page instance may emit.
*
@@ -1451,8 +1443,39 @@ export class Page extends EventEmitter {
}
}
- async emulateVisionDeficiency(type?: VisionDeficiency): Promise {
- const visionDeficiencies = new Set([
+ /**
+ * Simulates the given vision deficiency on the page.
+ *
+ * @example
+ * ```js
+ * const puppeteer = require('puppeteer');
+ *
+ * (async () => {
+ * const browser = await puppeteer.launch();
+ * const page = await browser.newPage();
+ * await page.goto('https://v8.dev/blog/10-years');
+ *
+ * await page.emulateVisionDeficiency('achromatopsia');
+ * await page.screenshot({ path: 'achromatopsia.png' });
+ *
+ * await page.emulateVisionDeficiency('deuteranopia');
+ * await page.screenshot({ path: 'deuteranopia.png' });
+ *
+ * await page.emulateVisionDeficiency('blurredVision');
+ * await page.screenshot({ path: 'blurred-vision.png' });
+ *
+ * await browser.close();
+ * })();
+ * ```
+ *
+ * @param type - the type of deficiency to simulate, or `'none'` to reset.
+ */
+ async emulateVisionDeficiency(
+ type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']
+ ): Promise {
+ const visionDeficiencies = new Set<
+ Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']
+ >([
'none',
'achromatopsia',
'blurredVision',
diff --git a/utils/doclint/check_public_api/index.js b/utils/doclint/check_public_api/index.js
index fa8aa5c9..f91205ea 100644
--- a/utils/doclint/check_public_api/index.js
+++ b/utils/doclint/check_public_api/index.js
@@ -653,7 +653,7 @@ function compareDocumentations(actual, expected) {
'Method Page.emulateVisionDeficiency() type',
{
actualName: 'string',
- expectedName: 'VisionDeficiency',
+ expectedName: 'Object',
},
],
[