Thursday, October 11, 2018

Get Frame and counting where is the frame....

 


 

Taken from https://stackoverflow.com/a/36264064 as Note and here the main problem https://stackoverflow.com/questions/36105240/cefsharp-and-frames-only-retrieving-html-from-first-frame

    public static IFrame GetFrame(this ChromiumWebBrowser browser, string FrameName)
    {
        IFrame frame = null;

        var identifiers = browser.GetBrowser().GetFrameIdentifiers();

        foreach (var i in identifiers)
        {
            frame = browser.GetBrowser().GetFrame(i);
            if (frame.Name == FrameName)
                return frame;
        }

        return null;
    }
var frame = browser.GetFrame("nameofframe");
        if (frame != null)
            frame.EvaluateScriptAsync("document.getElementById('whateveridyouwanttoclick').click();");