Although we recommend to look up GUI components using a ContainerFixture, we can also use a ComponentFinder.
ComponentFinder supports different types of component lookup:
- by name
- by type
- by name and type
- custom search criteria using a
ComponentMatcher - custom search criteria using a
GenericTypeMatcher
For more details, please read ComponentFinder's Javadoc documentation.
Obtaining a ComponentFinder
There are three ways to obtain a ComponentFinder:
1. By creating a new ComponentFinder that has access to all the GUI components in the AWT hierarchy.
2. By creating a new ComponentFinder that only has access to the GUI components created after it.
In the following example, finder has access to 'login' but not to 'main'.
3. By reusing an existing ComponentFinder from a Robot.
In the following example we are going to use the Robot from a FrameFixture 'frame':