Search in sources :

Example 1 with InstanceOfMatcher

use of javafxlibrary.matchers.InstanceOfMatcher in project JavaFXLibrary by eficode.

the class ConvenienceKeywords method findClass.

@RobotKeyword("Returns the *first* node matching the query. \n\n" + "``query`` is the Class name String to use in lookup.\n" + "\nExample:\n" + "| ${my node}= | Find | javafx.scene.control.Button | # button class |")
@ArgumentNames({ "query" })
public Object findClass(final String query) {
    try {
        Class<?> clazz = Class.forName(query);
        InstanceOfMatcher matcher = new InstanceOfMatcher(clazz);
        return mapObject(robot.lookup(matcher).query());
    } catch (Exception e) {
        robotLog("TRACE", "Problem has occurred during node lookup: " + e);
        return "";
    }
}
Also used : InstanceOfMatcher(javafxlibrary.matchers.InstanceOfMatcher) JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) RobotKeyword(org.robotframework.javalib.annotation.RobotKeyword) ArgumentNames(org.robotframework.javalib.annotation.ArgumentNames)

Aggregations

JavaFXLibraryNonFatalException (javafxlibrary.exceptions.JavaFXLibraryNonFatalException)1 InstanceOfMatcher (javafxlibrary.matchers.InstanceOfMatcher)1 ArgumentNames (org.robotframework.javalib.annotation.ArgumentNames)1 RobotKeyword (org.robotframework.javalib.annotation.RobotKeyword)1