mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
parent
f82c03682a
commit
d0c4291995
@ -45,4 +45,5 @@ JSHandle instances can be used as arguments for [Page.$eval()](./puppeteer.page.
|
||||
| [getProperty(propertyName)](./puppeteer.jshandle.getproperty.md) | | Fetches a single property from the referenced object. |
|
||||
| [getProperty(propertyName)](./puppeteer.jshandle.getproperty_1.md) | | |
|
||||
| [jsonValue()](./puppeteer.jshandle.jsonvalue.md) | | |
|
||||
| [remoteObject()](./puppeteer.jshandle.remoteobject.md) | | Provides access to \[Protocol.Runtime.RemoteObject\](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/\#type-RemoteObject) backing this JSHandle. |
|
||||
| [toString()](./puppeteer.jshandle.tostring.md) | | Returns a string representation of the JSHandle. |
|
||||
|
19
docs/api/puppeteer.jshandle.remoteobject.md
Normal file
19
docs/api/puppeteer.jshandle.remoteobject.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: JSHandle.remoteObject
|
||||
---
|
||||
|
||||
# JSHandle.remoteObject() method
|
||||
|
||||
Provides access to \[Protocol.Runtime.RemoteObject\](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/\#type-RemoteObject) backing this JSHandle.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class JSHandle {
|
||||
remoteObject(): Protocol.Runtime.RemoteObject;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Protocol.Runtime.RemoteObject
|
@ -49,7 +49,7 @@
|
||||
"docs": "run-s build generate:markdown",
|
||||
"debug": "npm run build && mocha --inspect-brk",
|
||||
"commitlint": "commitlint --from=HEAD~1",
|
||||
"clean": "rimraf lib",
|
||||
"clean": "rimraf lib && rimraf test/build",
|
||||
"check": "run-p check:*",
|
||||
"check:protocol-revision": "ts-node -s scripts/ensure-correct-devtools-protocol-package",
|
||||
"check:pinned-deps": "ts-node -s scripts/ensure-pinned-deps",
|
||||
|
@ -291,6 +291,13 @@ export class JSHandle<T = unknown> {
|
||||
}
|
||||
return 'JSHandle:' + valueFromRemoteObject(this.#remoteObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides access to [Protocol.Runtime.RemoteObject](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject) backing this JSHandle.
|
||||
*/
|
||||
remoteObject(): Protocol.Runtime.RemoteObject {
|
||||
return this.#remoteObject;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,8 @@ export * from './common/QueryHandler.js';
|
||||
export * from './common/DeviceDescriptors.js';
|
||||
export * from './common/Errors.js';
|
||||
|
||||
export {Protocol} from 'devtools-protocol';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
@ -36,6 +36,14 @@ describe('JSHandle', function () {
|
||||
});
|
||||
expect(windowHandle).toBeTruthy();
|
||||
});
|
||||
it('should return the RemoteObject', async () => {
|
||||
const {page} = getTestState();
|
||||
|
||||
const windowHandle = await page.evaluateHandle(() => {
|
||||
return window;
|
||||
});
|
||||
expect(windowHandle.remoteObject()).toBeTruthy();
|
||||
});
|
||||
it('should accept object handle as an argument', async () => {
|
||||
const {page} = getTestState();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user