diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md
index 3ea2180873d87..686db16f4a7c5 100644
--- a/docs/src/api/class-browsercontext.md
+++ b/docs/src/api/class-browsercontext.md
@@ -748,83 +748,6 @@ await page.SetContentAsync("
-
Click me
- Or click me
-`);
-```
-
-```java
-context.exposeBinding("clicked", (source, args) -> {
- ElementHandle element = (ElementHandle) args[0];
- System.out.println(element.textContent());
- return null;
-}, new BrowserContext.ExposeBindingOptions().setHandle(true));
-page.setContent("" +
- "\n" +
- "Click me
\n" +
- "Or click me
\n");
-```
-
-```python async
-async def print(source, element):
- print(await element.text_content())
-
-await context.expose_binding("clicked", print, handle=true)
-await page.set_content("""
-
- Click me
- Or click me
-""")
-```
-
-```python sync
-def print(source, element):
- print(element.text_content())
-
-context.expose_binding("clicked", print, handle=true)
-page.set_content("""
-
- Click me
- Or click me
-""")
-```
-
-```csharp
-var result = new TaskCompletionSource();
-var page = await Context.NewPageAsync();
-await Context.ExposeBindingAsync("clicked", async (BindingSource _, IJSHandle t) =>
-{
- return result.TrySetResult(await t.AsElement().TextContentAsync());
-});
-
-await page.SetContentAsync("\n" +
- "Click me
\n" +
- "Or click me
\n");
-
-await page.ClickAsync("div");
-// Note: it makes sense to await the result here, because otherwise, the context
-// gets closed and the binding function will throw an exception.
-Assert.AreEqual("Click me", await result.Task);
-```
-
### param: BrowserContext.exposeBinding.name
* since: v1.8
- `name` <[string]>
@@ -839,6 +762,7 @@ Callback function that will be called in the Playwright's context.
### option: BrowserContext.exposeBinding.handle
* since: v1.8
+* deprecated: This option will be removed in the future.
- `handle` <[boolean]>
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index d087b78c9f696..3d667bb186693 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -1817,80 +1817,6 @@ class PageExamples
}
```
-An example of passing an element handle:
-
-```js
-await page.exposeBinding('clicked', async (source, element) => {
- console.log(await element.textContent());
-}, { handle: true });
-await page.setContent(`
-
- Click me
- Or click me
-`);
-```
-
-```java
-page.exposeBinding("clicked", (source, args) -> {
- ElementHandle element = (ElementHandle) args[0];
- System.out.println(element.textContent());
- return null;
-}, new Page.ExposeBindingOptions().setHandle(true));
-page.setContent("" +
- "\n" +
- "Click me
\n" +
- "Or click me
\n");
-```
-
-```python async
-async def print(source, element):
- print(await element.text_content())
-
-await page.expose_binding("clicked", print, handle=true)
-await page.set_content("""
-
- Click me
- Or click me
-""")
-```
-
-```python sync
-def print(source, element):
- print(element.text_content())
-
-page.expose_binding("clicked", print, handle=true)
-page.set_content("""
-
- Click me
- Or click me
-""")
-```
-
-```csharp
-var result = new TaskCompletionSource();
-await page.ExposeBindingAsync("clicked", async (BindingSource _, IJSHandle t) =>
-{
- return result.TrySetResult(await t.AsElement().TextContentAsync());
-});
-
-await page.SetContentAsync("\n" +
- "Click me
\n" +
- "Or click me
\n");
-
-await page.ClickAsync("div");
-Console.WriteLine(await result.Task);
-```
-
### param: Page.exposeBinding.name
* since: v1.8
- `name` <[string]>
@@ -1905,6 +1831,7 @@ Callback function that will be called in the Playwright's context.
### option: Page.exposeBinding.handle
* since: v1.8
+* deprecated: This option will be removed in the future.
- `handle` <[boolean]>
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 28250cb271b0b..0edaacc0b8127 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -814,21 +814,6 @@ export interface Page {
* })();
* ```
*
- * An example of passing an element handle:
- *
- * ```js
- * await page.exposeBinding('clicked', async (source, element) => {
- * console.log(await element.textContent());
- * }, { handle: true });
- * await page.setContent(`
- *
- * Click me
- * Or click me
- * `);
- * ```
- *
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @param options
@@ -875,21 +860,6 @@ export interface Page {
* })();
* ```
*
- * An example of passing an element handle:
- *
- * ```js
- * await page.exposeBinding('clicked', async (source, element) => {
- * console.log(await element.textContent());
- * }, { handle: true });
- * await page.setContent(`
- *
- * Click me
- * Or click me
- * `);
- * ```
- *
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @param options
@@ -7637,21 +7607,6 @@ export interface BrowserContext {
* })();
* ```
*
- * An example of passing an element handle:
- *
- * ```js
- * await context.exposeBinding('clicked', async (source, element) => {
- * console.log(await element.textContent());
- * }, { handle: true });
- * await page.setContent(`
- *
- * Click me
- * Or click me
- * `);
- * ```
- *
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @param options
@@ -7693,21 +7648,6 @@ export interface BrowserContext {
* })();
* ```
*
- * An example of passing an element handle:
- *
- * ```js
- * await context.exposeBinding('clicked', async (source, element) => {
- * console.log(await element.textContent());
- * }, { handle: true });
- * await page.setContent(`
- *
- * Click me
- * Or click me
- * `);
- * ```
- *
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
* @param options