String createJsFunction(String name, Function<Object[], Object> toDo);
/** Get a global variable name. */
- public String getJsVarName(String name);
+ String getJsVarName(String name);
/**
* Completion stage when the client is ready (typically the page has loaded in
}
default boolean isInstanceOf(String reference, String jsClass) {
- return (Boolean) evaluate(getJsVarName(reference) + " instanceof " + jsClass);
+ try {
+ return (Boolean) evaluate("return " + getJsVarName(reference) + " instanceof " + jsClass);
+ } catch (Exception e) {
+ // TODO better understand why instanceof is often failing with SWT Browser
+ return false;
+ }
}
/*