Page 1 of 1

Better handling of frames, constructing frame path

PostPosted: Mon Feb 08, 2016 5:19 am
by Petr
Hi,

I would like to have information about frames tree order. FE suppose page with frame
Code: Select all
MAINFRAME //TOP:0
    frame[0] //TOP:0/Frame:0
        frame[0] //TOP:0/Frame:0/Frame:0
        frame[1] //TOP:0/Frame:0/Frame:1
           frame[0] //TOP:0/Frame:0/Frame:1/Frame:0
           frame[1] //TOP:0/Frame:0/Frame:1/Frame:1
    frame[1] //TOP:0/Frame:1


Commented code show my idea how this can be done. Basically only things which have to be done is to add possibility to obtain child, left and right siblings and parent frames of frame. I was originally asking this question to dev of CefSharp, but I was told that he is not aware that this is implemented in CEF. I am using CefSharp for creation internal automation tool, and having this frame path is crucial to some pages.

Petr

Re: Better handling of frames, constructing frame path

PostPosted: Mon Feb 08, 2016 12:11 pm
by magreenblatt
You can retrieve all frames in C++ using CefBrowser::GetFrameIdentifiers() and CefBrowser::GetFrame(). See also comments on CefFrame::GetName().

Re: Better handling of frames, constructing frame path

PostPosted: Mon Feb 08, 2016 2:18 pm
by Petr
I can obtain frames, but I would also like to obtain this parent child relationship? It will only when frames does not have any name or id, if it has then this info disappears. I am talking about CefSharp I am not so familiar with c++ syntax :(

Re: Better handling of frames, constructing frame path

PostPosted: Mon Feb 08, 2016 2:41 pm
by magreenblatt
The list returned by GetFrameIdentifiers() should be ordered (e.g. siblings will be in order, parents will come before children, etc). You can then use CefFrame::GetParent to discover the hierarchy and build a string of your choice. I agree that this isn't quite as convenient as a GetNextSibling/GetChildren-style API could be.