Diga.WebView2 icon indicating copy to clipboard operation
Diga.WebView2 copied to clipboard

GetDomWindow.frames

Open p3rson101 opened this issue 3 years ago • 4 comments

When trying to access GetDOMWindow.frames.item(0) it states this is ambiguous since there is a property named the same is there anyway to update this so they are seperate names I am unable to get each frame due to this error.

p3rson101 avatar Sep 11 '22 17:09 p3rson101

I’m trying to work around it but when I do the getDomDocument.getElementbyId(“iframeid”) and Assign to a DOMElement I can not get the document out of the element ? So that I can search the iframe document for specific ids.

p3rson101 avatar Sep 12 '22 02:09 p3rson101

You're right, currently the frames property doesn't return a list of window items. You can only access an IFrame element by its ID. You cannot access the window object of the frame via this element. This will be implemented at a later date. However, you could use the webView1_FrameCreated event to pass your own objects to the frame and run your own scripts in the frame. https://docs.microsoft.com/de-de/microsoft-edge/webview2/reference/win32/icorewebview2frame?view=webview2-1.0.1343.22#addhostobjecttoscriptwithorigins https://docs.microsoft.com/de-de/microsoft-edge/webview2/reference/win32/icorewebview2frame2?view=webview2-1.0.1343.22#executescript

ITAgnesmeyer avatar Sep 12 '22 07:09 ITAgnesmeyer

Ok would it be possible to get the src of the iframe and open a window using the src

p3rson101 avatar Sep 12 '22 15:09 p3rson101

If you got the IFrame DOMElement you can call GetPorperty("srcdoc") https://www.w3schools.com/tags/tag_iframe.asp

ITAgnesmeyer avatar Sep 12 '22 15:09 ITAgnesmeyer