How do I get Element from IElement?

Ask general questions here.
taralex
Posts: 57
Joined: Tue Nov 04, 2008 3:50 pm
Location: Michigan
Contact:

How do I get Element from IElement?

Post by taralex » Tue Nov 25, 2008 11:42 pm

I learnd how to browse the tree of application elements (IElement.Children) and find the required element by its attribute name. However, now I need to click it, but Click method belongs to Ranorex.Element object. How do I get the Ranorex.Element object out of the corresponding Ranorex.Core.IElement object?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Wed Nov 26, 2008 9:54 am

Hey taralex,
you can use the Ranorex.Core.Mouse class for IElement/Element Objects.

Code: Select all

Element elem = CalculatorObjects.Button7.Element.As<Element>();
Mouse.Click(elem);

(maybe this conversion will not work with Preview Revision lower than Build 4593)

in Ranorex 2.0 Preview (Build 4395 - October 21, 2008) you can use the IElement Object instead.

Regards,
Chris
Ranorex Support Team