Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: update import in code example (#22591)

Rubenf9eeaa2b7536
diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md
index b535fdd1c8..33f8a2df5e 100644
--- a/docs/src/api/class-frame.md
+++ b/docs/src/api/class-frame.md
@@ -1857,7 +1857,7 @@ const { firefox } = require('playwright'); // Or 'chromium' or 'webkit'.
const browser = await firefox.launch();
const page = await browser.newPage();
const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
- page.setViewportSize({width: 50, height: 50});
+ await page.setViewportSize({width: 50, height: 50});
await watchDog;
await browser.close();
})();
diff --git a/docs/src/api/class-selectors.md b/docs/src/api/class-selectors.md
index a4d8cee9c0..27ad6cdad5 100644
--- a/docs/src/api/class-selectors.md
+++ b/docs/src/api/class-selectors.md
@@ -14,7 +14,7 @@ Selectors must be registered before creating the page.
An example of registering selector engine that queries elements based on a tag name:
```js
-const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'.
+const { selectors, firefox } = require('@playwright/test'); // Or 'chromium' or 'webkit'.
(async () => {
// Must be a function that evaluates to a selector engine instance.
diff --git a/docs/src/test-components-js.md b/docs/src/test-components-js.md
index f89cfa6755..69dbb503f3 100644
--- a/docs/src/test-components-js.md
+++ b/docs/src/test-components-js.md
@@ -236,7 +236,7 @@ This includes any config that needs to be run before or after mounting the compo
```js
// src/pages/ProductsPage.spec.tsx
import { test, expect } from '@playwright/experimental-ct-react';
- import type { HooksConfig } from 'playwright';
+ import type { HooksConfig } from '@playwright/test';
import { ProductsPage } from './pages/ProductsPage';
test('configure routing through hooks config', async ({ page, mount }) => {
@@ -271,7 +271,7 @@ This includes any config that needs to be run before or after mounting the compo
```js
// src/pages/ProductsPage.spec.tsx
import { test, expect } from '@playwright/experimental-ct-solid';
- import type { HooksConfig } from 'playwright';
+ import type { HooksConfig } from '@playwright/test';
import { ProductsPage } from './pages/ProductsPage';
test('configure routing through hooks config', async ({ page, mount }) => {
@@ -306,7 +306,7 @@ This includes any config that needs to be run before or after mounting the compo
```js
// src/pages/ProductsPage.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue';
- import type { HooksConfig } from 'playwright';
+ import type { HooksConfig } from '@playwright/test';
import ProductsPage from './pages/ProductsPage.vue';
test('configure routing through hooks config', async ({ page, mount }) => {
@@ -343,7 +343,7 @@ This includes any config that needs to be run before or after mounting the compo
```js
// src/pages/ProductsPage.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue2';
- import type { HooksConfig } from 'playwright';
+ import type { HooksConfig } from '@playwright/test';
import ProductsPage from './pages/ProductsPage.vue';
test('configure routing through hooks config', async ({ page, mount }) => {
@@ -599,7 +599,7 @@ Pinia needs to be initialized in `playwright/index.{js,ts,jsx,tsx}`. If you do t
```js
// src/pinia.spec.ts
import { test, expect } from '@playwright/experimental-ct-vue';
- import type { HooksConfig } from 'playwright';
+ import type { HooksConfig } from '@playwright/test';
import Store from './Store.vue';
test('override initialState ', async ({ mount }) => {
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index e8a6d7b880..7db8d1bdb1 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -5182,7 +5182,7 @@ export interface Frame {
* const browser = await firefox.launch();
* const page = await browser.newPage();
* const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
- * page.setViewportSize({width: 50, height: 50});
+ * await page.setViewportSize({width: 50, height: 50});
* await watchDog;
* await browser.close();
* })();
@@ -5216,7 +5216,7 @@ export interface Frame {
* const browser = await firefox.launch();
* const page = await browser.newPage();
* const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
- * page.setViewportSize({width: 50, height: 50});
+ * await page.setViewportSize({width: 50, height: 50});
* await watchDog;
* await browser.close();
* })();
@@ -18536,7 +18536,7 @@ export interface Selectors {
* An example of registering selector engine that queries elements based on a tag name:
*
* ```js
- * const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webkit'.
+ * const { selectors, firefox } = require('@playwright/test'); // Or 'chromium' or 'webkit'.
*
* (async () => {
* // Must be a function that evaluates to a selector engine instance.