Popup window identification - @form to @dom

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Dinin
Posts: 5
Joined: Tue Jan 14, 2014 4:46 pm

Popup window identification - @form to @dom

Post by Dinin » Tue Jan 14, 2014 4:52 pm

Hello guys,

I have a problem of which I spent 3 days and no useful solution for it.
I'm beginer with RR, sorry for the question if it is too bad or I mix some things. I'm using RR 4.0.5 with .net 4.0 on windows7.


Scenario:

  • Open a page which contains links in IE.
    Press CTRL and click on a link. It opens the link in new window.
    Try to get the location of the new Window. (validation)


My first idea was to found out the process id. But in Spy I saw if see DOM container I see now difference just the url-s. That is not helped me.
I checked the Form objects and realized a strange thing: both of the form object /IEFrame/ has the same process Id while I see the two windows in windows'task manager with different process Id.
I tried to grab the new process id but I was not able to do it in RR.
I also realized the Instance attribute of the NativeWindow view changed for the new (popup) window.
I wrote RRpath which can identify the forms separetely like this:

Original window:

Code: Select all

form[@processname='iexplore' and @visible='true' and @instance='0']
Popup window:

Code: Select all

form[@processname='iexplore' and @visible='true' and @instance='1']
This worked fine, but I had Ranorex.Form element instead of Ranorex.WebDocument.
With this Form I couldn't get the location and I also had problems to access to the page elements.
But I don't see how can I convert from this Form element to WebDocument element or how I can do the popup window identification on some different ways.
  • Is there any easier way to follow popups?
    Is this duplicated process Id ok or is this a bug?
    How can I get application window from Form element?
Thanks

Laszlo

User avatar
rprehm
Posts: 24
Joined: Tue Dec 17, 2013 6:43 pm

Re: Popup window identification - @form to @dom

Post by rprehm » Fri Jan 17, 2014 2:28 pm

Hello Dinin,

I suppose you get the DOM object of both pages in the Ranorex Spy. If there are only a few instances in your whole test case and you don’t need a dynamic access to your DOM objects you can distinguish between the different instances using an index:

Code: Select all

/dom[@caption=’Sample’][0]
/dom[@caption=’Sample’][1]
As a small sample :

• Show the location of my WebDocument in the report

Code: Select all

WebDocument doc = @"/dom[@caption=’Sample’][0];
			Point p = doc.Element.ScreenLocation;
			Report.Info("Location of the Webdocument: " + p);
Regards,
Robert

Dinin
Posts: 5
Joined: Tue Jan 14, 2014 4:46 pm

Re: Popup window identification - @form to @dom

Post by Dinin » Mon Jan 20, 2014 1:34 pm

Hi Robert,

thanks for your investigation but I need to access dynamically. What I did and working at the moment - I'm not sure how bad solution is - to first query the @form because I have the properties from the testcase which I can use to identify the form object.
After I collect all the @dom object and get theirs @from properties to compare the already selected @form from the first query. If it matched by some properties I return with that @dom object reference in what I found the @form.

I'm very happy if anyone have better solution for this problem.


tx.

User avatar
rprehm
Posts: 24
Joined: Tue Dec 17, 2013 6:43 pm

Re: Popup window identification - @form to @dom

Post by rprehm » Tue Jan 21, 2014 4:44 pm

Hello Dinin,

Referring to your first forum post why is it not suitable for you to distinguish between the DOM-objects using the URL’s?
Am I right that you are using the DOM-objects just for validating the location of the pop-up window or do you perform any other actions too?

Is it possible to send a Ranorex Snapshot-file (Creating Ranorex Snapshot Files) and some screenshots to: [email protected]

Regards,
Robert

Dinin
Posts: 5
Joined: Tue Jan 14, 2014 4:46 pm

Re: Popup window identification - @form to @dom

Post by Dinin » Fri Jun 06, 2014 2:21 pm

Thanks for your answer Robert, I did it.