You cannot inspect the Editor - GUI directly, because there is nothing that could be inspected. The labels and everything is drawn “on the fly”, thats why its also called “Immediate GUI”.
What you can do, is to try to get to the same data source that the editor usually uses to draw its stuff.
For the Inspector, this would be the SerializedObject of the current selected objects. (You can enumerate its SerializedProperty using GetEnumerator()).
For the Project view, that are all assets in the directory of the current selected object (actually, its more complicated as you can select “folders only” which does not really appear in Unity’s Selection.objects. But its good enough most of the time).
For the Hierarchy, that are all GameObjects and all their childs. You can iterate childs by calling transform.childCount and transform.GetChild(i) in a for-loop. Or you just do foreach (Transform child in transform) (which you should not do in Update-loops during runtime or common called functions as it allocates memory. But in editor-code its ok, I guess…)