Adapters, Elements, Lifetimes

Class library usage, coding and language questions.
Posts: 3
Joined: Mon Oct 09, 2017 12:49 pm

Adapters, Elements, Lifetimes

Post by fk4rx » Fri Dec 11, 2020 10:33 am


Despite working with Ranorex for >3 yrs, I have never understood what the Element object underneath an Adapter object really is, what their relationships are, and how long these objects "live". I unsuccessfully tried to find explanations in the API documentation and in the User Guide, so this forum is my last chance ;-) OK here are my questions:

(1) for a given Adapter object (e.g. of type Ranorex.Button), WHY is there also an Element object beneath? What's their difference?
(2) are the Element objects created as a result of the Ranorex injection into the AUT? If not, who creates them?
(3) how long do Adapter objects and Element objects "live", e.g. after the control in the AUT is no longer shown?
(4) what's the real meaning of the Adapter.Valid property (the documentation is mysterious...)?

Addendum to (3): for example, I have observed than an adapter's screen rectangle changes to 0,0,0,0 when the corresponding control in the AUT is no longer shown in the GUI, however the adapter (and element) still "lives" ... but for how long?

I am looking forward to some helpful insights into these concepts ... thanks in advance!