This is a migrated thread and some comments may be shown as answers.

ActiveBrowser.Frames are shifted for Internet Explorer

3 Answers 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Toldo
Top achievements
Rank 1
Toldo asked on 03 Aug 2013, 08:43 PM
Hi guys,

I faced a pretty specific problem.
As I know in order to access nested iFrames in Telerik Testing Framework I have to use ActiveBrowser.Frames collection.
The problem is that this collection is filled different way for IE and other browsers.

For Chrome and Firefox the frames collection is filled in the order frames are rendered in DOM. E.g. last added frame is last in the list.
So that frames have static indexes.

In IE the frames in collection are listed in the order of their appearance in the DOM. When the new iFrames are added before older frames their indexes are shifted.

It looks like this thing cause tricky issue when kind of collision of similar frames appears in complex web application. Found elements interactions are performed on active (with bigger z-index) frame instead of their original frame. I was not able to reproduce my issue on any public page but below is code that demonstrate the difference in framework behavior in IE and other browsers. It passes in Chrome and Firefox while fails in IE.

var radEditor1 = ActiveBrowser.Frames.ById("~RadEditor");
Assert.That(ActiveBrowser.Frames.Count, Is.EqualTo(1));
var openButton = ActiveBrowser.Find.jQuery().attributes("title=Open Advanced Editor").first<HtmlAnchor>();
openButton.Click();
ActiveBrowser.RefreshDomTree();
var radEditor2 = ActiveBrowser.Frames.ById("~RadEditor");
Assert.That(radEditor1.FrameInfo.Index, Is.EqualTo(radEditor2.FrameInfo.Index));

Currently I managed to work around by searching for frame by its UniqueId every time I need to interact with it (if there is more elegant way to "refresh" the frame I would appreciate your advice). But I hope that it can be fixed in the framework so that it works same way in all browsers and after coming release we do not need to write additional logic specially for IE.

Thank you in advance.

3 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 07 Aug 2013, 07:41 PM
Hi Toldo,

But I hope that it can be fixed in the framework so that it works same way in all browsers and after coming release we do not need to write additional logic specially for IE.

I don't fully understand why you have to do things differently for IE compared to the other browsers? Our official recommendation is to find the correct frame using some unique property (id or name or url, etc.) and avoid using static index value. The biggest hazard with using index value is that all of your tests will break if the application changes causing what used to be frame 1 to become frame 2 (or 0). By always searching for unique ID you avoid this hazard and test maintenance.

The indexing behavior you describe is not something we can fix. We ask the browser for a list of frames and present them to you, the tester, in whatever order the browser gives them to us in. We have no control over this.

Regards,
Cody
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Toldo
Top achievements
Rank 1
answered on 08 Aug 2013, 07:39 PM
Hi Cody,

Actually I find frame by ID and everything works fine until similar frame appears in the DOM tree before already found frame.
HtmlControls assigned to variables start to work with newly added frame instead of original. The only found way to "refresh" them is to find frame and all elements needed again. This behavior is typical for IE only, so I supposed that the reason is index shift (it is the only property changed in FrameInfo).

However, thank you for your attention to my question.
0
Cody
Telerik team
answered on 09 Aug 2013, 01:24 AM
Hello,

The only found way to "refresh" them is to find frame and all elements needed again.

That is the best way to handle the scenario of a new <iframe> being added to the parent HTML. It doesn't seem reasonable to me to expect Test Studio to be able to keep track of where a frame got moved to in such a scenario. It seems to me you simply got lucky with the other browsers.

Regards,
Cody
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Toldo
Top achievements
Rank 1
Answers by
Cody
Telerik team
Toldo
Top achievements
Rank 1
Share this question
or