Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10e2931

Browse files
committed
Helper function for bringing the window that's going to be clicked on the front
1 parent 8a48b7e commit 10e2931

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/javafxlibrary/utils/HelperFunctions.java

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import javafx.stage.Window;
3030
import javafxlibrary.exceptions.JavaFXLibraryNonFatalException;
3131
import javafxlibrary.exceptions.JavaFXLibraryTimeoutException;
32+
import javafxlibrary.keywords.AdditionalKeywords.ConvenienceKeywords;
3233
import javafxlibrary.matchers.ProgressBarMatchers;
3334
import javafxlibrary.utils.finder.Finder;
3435
import org.apache.commons.lang3.StringUtils;
@@ -425,6 +426,7 @@ public static void checkClickLocation(int x, int y) {
425426
public static void checkClickLocation(Object object) {
426427

427428
RobotLog.trace("Checking if target \"" + object.toString() + "\" is within active window");
429+
verifyClickLocationOnFront(object);
428430

429431
if (safeClicking) {
430432

@@ -438,6 +440,10 @@ public static void checkClickLocation(Object object) {
438440
}
439441
RobotLog.trace("Target location checks out OK, it is within active window");
440442
}
443+
444+
public static void verifyClickLocationOnFront(Object object) {
445+
new ConvenienceKeywords().bringStageToFront((Stage) objectToNode(object).getScene().getWindow());
446+
}
441447

442448
public static Object checkClickTarget(Object target) {
443449
try {

0 commit comments

Comments
 (0)