Can a native interface be obtained from the Browser or Page instance to verify if an object is an instanceof
this interface?
For example, in a testing scenario with jest (where CanvasRenderingContext2D is not available due to being a Node context rather than JSDOM or another browser API emulation):
it("should create an instance of CanvasRenderingContext2D", async () => {
expect.assertions(1);
const context = await page.evaluate(() => {
return document.createElement("canvas").getContext("2d");
});
// Is there a way to use a JSHandle?
const CanvasRenderingContext2DInterface = await page.evaluateHandle(() => CanvasRenderingContext2D);
expect(context).toBeInstanceOf(CanvasRenderingContext2DInterface);
});