I'm trying to write code to work with an already running IE window. The issue I'm having is that there might be multiple IE windows open, and I need to make sure I connect to the correct one. The only way I know is by looking at the DOM container for the correct IE window, and by checking the PageUrl for this DOM object (each running IE window I want to work with has a unique session number as part of the URL, which I know).
So, I wrote some code to get all the IE forms into a collection and I'm iterating through them, but how do I know which DOM container goes with the form? I cannot go by Caption, since they are all the same.
Thanks,
Aracknid
How to associate the DOM container with the correct IE Form
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to associate the DOM container with the correct IE Form
Could the WebDocument.Browser property be the thing you are searching? That property returns the Form adapter corresponding to the web document. So you can get the browser form for a DOM directly using that property.
Regards,
Alex
Ranorex Team
Regards,
Alex
Ranorex Team
Re: How to associate the DOM container with the correct IE Form
What you've suggested is backwards to what I was thinking. Maybe I can try it the other way around and see if it works for me...
When I'm in the Spy window, I see the IE Forms and the DOM objects (which have a preferredCapability as a WebDocument). I also found that I can drill down into the Form and find the DOM in the 'Shell DocObject View' container of the Element 'Frame Tab'. But I just wanted to find the DOM item off the root that went with the Form since I figured it was easier than drilling down into the Form.
Aracknid
When I'm in the Spy window, I see the IE Forms and the DOM objects (which have a preferredCapability as a WebDocument). I also found that I can drill down into the Form and find the DOM in the 'Shell DocObject View' container of the Element 'Frame Tab'. But I just wanted to find the DOM item off the root that went with the Form since I figured it was easier than drilling down into the Form.
Aracknid
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to associate the DOM container with the correct IE Form
Right, the DOM element in the top level of the Ranorex element tree is basically just a copy of the DOM within the form. The two corresponding DOM elements (top level and underneath "Shell DocObject View") are identical, so you can use either one.Aracknid wrote:I also found that I can drill down into the Form and find the DOM in the 'Shell DocObject View' container of the Element 'Frame Tab'.
Regards,
Alex
Ranorex Team