diff --git a/lib/PuppeteerSharp/Cdp/CdpElementHandle.cs b/lib/PuppeteerSharp/Cdp/CdpElementHandle.cs index 9d019bcbc..19c2a5245 100644 --- a/lib/PuppeteerSharp/Cdp/CdpElementHandle.cs +++ b/lib/PuppeteerSharp/Cdp/CdpElementHandle.cs @@ -37,13 +37,18 @@ public class CdpElementHandle : ElementHandle internal CdpElementHandle( IsolatedWorld world, - RemoteObject remoteObject) : base(world, remoteObject) + RemoteObject remoteObject) { Handle = new CdpJSHandle(world, remoteObject); Logger = Realm.Environment.Client.Connection.LoggerFactory.CreateLogger(GetType()); _cdpFrame = Realm.Frame as CdpFrame; } + /// + public override RemoteObject RemoteObject => Handle.RemoteObject; + + internal override IsolatedWorld Realm => Handle.Realm; + /// /// Logger. /// diff --git a/lib/PuppeteerSharp/Cdp/CdpJSHandle.cs b/lib/PuppeteerSharp/Cdp/CdpJSHandle.cs index d93301d14..dba627f9d 100644 --- a/lib/PuppeteerSharp/Cdp/CdpJSHandle.cs +++ b/lib/PuppeteerSharp/Cdp/CdpJSHandle.cs @@ -31,11 +31,18 @@ namespace PuppeteerSharp.Cdp; /// public class CdpJSHandle : JSHandle { - internal CdpJSHandle(IsolatedWorld world, RemoteObject remoteObject) : base(world, remoteObject) + internal CdpJSHandle(IsolatedWorld world, RemoteObject remoteObject) { Logger = Client.Connection.LoggerFactory.CreateLogger(GetType()); + Realm = world; + RemoteObject = remoteObject; } + /// + public override RemoteObject RemoteObject { get; } + + internal override IsolatedWorld Realm { get; } + /// /// Logger. /// diff --git a/lib/PuppeteerSharp/ElementHandle.cs b/lib/PuppeteerSharp/ElementHandle.cs index de54e6903..7a46596ed 100644 --- a/lib/PuppeteerSharp/ElementHandle.cs +++ b/lib/PuppeteerSharp/ElementHandle.cs @@ -19,9 +19,7 @@ public abstract class ElementHandle : JSHandle, IElementHandle { private ElementHandle _isolatedHandle; - internal ElementHandle( - IsolatedWorld world, - RemoteObject remoteObject) : base(world, remoteObject) + internal ElementHandle() { } diff --git a/lib/PuppeteerSharp/JSHandle.cs b/lib/PuppeteerSharp/JSHandle.cs index 41e12dc09..01c840375 100644 --- a/lib/PuppeteerSharp/JSHandle.cs +++ b/lib/PuppeteerSharp/JSHandle.cs @@ -9,21 +9,19 @@ namespace PuppeteerSharp /// public abstract class JSHandle : IJSHandle { - internal JSHandle(IsolatedWorld world, RemoteObject remoteObject) + internal JSHandle() { - Realm = world; - RemoteObject = remoteObject; } /// public bool Disposed { get; protected set; } /// - public RemoteObject RemoteObject { get; } + public abstract RemoteObject RemoteObject { get; } internal Func DisposeAction { get; set; } - internal IsolatedWorld Realm { get; } + internal abstract IsolatedWorld Realm { get; } internal Frame Frame => Realm.Environment as Frame;