use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.
the class TestFxAdapter method setCurrentSessionScreenshotDirectory.
public void setCurrentSessionScreenshotDirectory(String dir) {
if (activeSession != null) {
File errDir = new File(dir);
if (!errDir.exists())
errDir.mkdirs();
activeSession.screenshotDirectory = dir;
} else
throw new JavaFXLibraryNonFatalException("Unable to set screenshot directory, no application is currently open!");
}
use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.
the class Session method closeApplication.
public void closeApplication() {
try {
FxToolkit.hideStage();
FxToolkit.cleanupStages();
sessionRobot.release(new KeyCode[] {});
sessionRobot.release(new MouseButton[] {});
// If application processes are left running, use isMac() or other HelperFunctions to call cleanup.
if (!HelperFunctions.isMac())
FxToolkit.cleanupApplication(sessionApplication);
} catch (Exception e) {
throw new JavaFXLibraryNonFatalException("Problem shutting down the application: " + e.getMessage(), e);
}
}
use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.
the class ApplicationLauncher method logSystemProperties.
@RobotKeyword("Prints all system properties that has been set with *Set System Property* -keyword\n")
public void logSystemProperties() {
try {
Properties p = System.getProperties();
Enumeration keys = p.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = (String) p.get(key);
HelperFunctions.robotLog("INFO", key + "=" + value);
}
} catch (Exception e) {
throw new JavaFXLibraryNonFatalException("Unable to log system properties", e);
}
}
use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.
the class ApplicationLauncher method logApplicationClassPath.
@RobotKeyword("Logs current classpath content")
public void logApplicationClassPath() {
try {
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
HelperFunctions.robotLog("INFO", "Printing out classpaths: \n");
for (URL url : urls) {
HelperFunctions.robotLog("INFO", url.getFile());
}
} catch (Exception e) {
throw new JavaFXLibraryNonFatalException("Unable to log application classpaths", e);
}
}
use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.
the class ConvenienceKeywords method getTableCellValue.
@RobotKeyword("Returns the value of cell in the given location\n\n" + "``locator`` is either a _query_ or _Object:Node_ for identifying the TableView element, see " + "`3. Locating or specifying UI elements`. \n\n" + "``row`` Integer value for the row\n\n" + "``column`` Integer value for the column")
@ArgumentNames({ "table", "row", "column" })
public Object getTableCellValue(Object locator, int row, int column) {
try {
TableView table = (TableView) objectToNode(locator);
Object item = table.getItems().get(row);
TableColumn col = (TableColumn) table.getColumns().get(column);
Object value = col.getCellObservableValue(item).getValue();
return HelperFunctions.mapObject(value);
} catch (ClassCastException cce) {
throw new JavaFXLibraryNonFatalException("Unable to handle argument as TableView!");
} catch (IndexOutOfBoundsException e) {
throw new JavaFXLibraryNonFatalException("Out of table bounds: " + e.getMessage());
} catch (Exception e) {
throw new JavaFXLibraryNonFatalException("Couldn't get table cell value");
}
}
Aggregations