Won't Fix
Last Updated: 23 Sep 2015 07:41 by ADMIN
ADMIN
Boyan Boev
Created on: 16 Jul 2015 08:08
Type: Bug Report
0
A difference appears in AfterCommandExecuted browser event handler
While implementing AfterCommandExecuted browser event handler there is a difference between sender and EventsArgs :

private void ActiveBrowser_AfterCommandExecuted(object sender, ArtOfTest.WebAii.EventsArgs.BrowserCommandEventArgs e)
        {
            var browser = (Browser)sender;

            //This returns true when there are frames in the browser
            if (e.Command.HasFrames)
            {

                //This returns the frameInfo in String form for all frames in current browser. 
                Manager.Log.WriteLine("FrameInfo :" + e.Command.FramesInfo);

                //At the same time the 'normal' browser returns a frameCount of zero
                Manager.Log.WriteLine("FrameCount from browser:" + browser.Frames.Count);
               
                           
               
            }
        }

e.Command.HasFrames returns true while browser.FramesCount returns 0

Steps to reproduce:

Download the attached project and run it. The implementation of the event handler is in the very first step.
Attached Files:
1 comment
ADMIN
Daniel Djambov
Posted on: 10 Aug 2015 10:55
Telerik: CommandExecuted events were implemented for internal communication between the framework and the client browser. A single Navigate step includes several commands starting from the request to navigate, going through informational messages and finishing with sending the document markup so that the framework can build the DOM for the loaded page. Once it has the DOM it updates the browser object with the frames so the sender browser instance cannot provide the browser frames earlier.

Also the event handler sender object is the active browser which is not updated with the frames until the DOM tree is refreshed. On the other side the e.Command is the response from the browser. Again, the active browser instance is not updated with the frames info during this communication.

This is the expected behavior when using it like this.