Selenium code with -> throws error in Katalon

Hi …

I am trying create a custom keyword using selenium java code … but this symbol is not recognized in katalon. Kindly help …

 public static void angularLoads(String angularReadyScript) {
 		try {
 			WebDriver driver = DriverFactory.getWebDriver();
 			ExpectedCondition<Boolean> angularLoad = driver -> Boolean.valueOf(((JavascriptExecutor) driver)
 catch (WebDriverException ignored) {

The purpose of this keyword is for Angular waits.

Confirmed. I just tried the jQuery example - same issue. I’m moving this to the Bugs category.

By the way, by creating this as a custom keyword, you’re recreating what Katalon’s WebUI APIs already do.

Hi Russ, FYI … The built in keyword WebUI.waitForAngularLoad(10) ; doesn’t work.

Kindly run the below script in chrome browser.



2019-03-21 16:22:42.617 WARN c.k.k.c.w.k.b.WaitForAngularLoadKeyword This page doesn’t use Angular.

Wow. That’s bad.

Okay, point noted. But let’s focus on the main topic: -> is legal in Groovy, and copying the code from the Se example should work.

@YoungNgo @devalex88 @ThanhTo can you guys take a look please?

1 Like

Actually in Groovy the closure syntax is {a -> code block} compared to Java’s lambda one a -> code block.

1 Like

I thought braces were optional in that scenario. Oh well. Thanks Alex.


Yep. Not optional.

1 Like


Thanks …

When using the below keyword getting null pointer exception, Could you please help me …


public static void angularLoads() {
try {

  	driver = DriverFactory.getWebDriver();
  	String angularReadyScript = 'return window.getAllAngularTestabilities().findIndex(x=>!x.isStable()) === -1';

  	ExpectedCondition<Boolean> angularLoad = { driver -> } Boolean.valueOf(((JavascriptExecutor) driver)

  	boolean angularReady = Boolean.valueOf(((JavascriptExecutor) driver).executeScript(angularReadyScript).toString());

  	if (!angularReady) {

  		new WebDriverWait(driver, 10).until(angularLoad); // this is failing -null pointer
  } catch (WebDriverException ignored) {


I’m really not familiar with the pattern you’re aiming for but I can see syntax errors.

Why don’t you follow the patterns @Brandon_Hein gave you in this thread?

Thanks Russ …

@Brandon_Hein …Any help on this is highly appreciated.

I am trying to create custom keyword for the latest Angular application, below is the link, I am interested on the below methods mentioned in the link.

private void waitForAngular5Load()
private void angularLoads(String angularReadyScript)

As @Russ_Thomas pointed out, you can (probably) use the same format that I used for checking jQuery conditions in the linked topic. For example, just take the javascript from your angularLoads() method and put it in the relevant place (in the js.executeScript() call):

public static void angularLoads() {
		new WebDriverWait(DriverFactory.getWebDriver(), 300, 100).until(new ExpectedCondition<Boolean>() {
					public Boolean apply(WebDriver d) {
						JavascriptExecutor js = (JavascriptExecutor)d;
						return (Boolean)js.executeScript(
								"return window.getAllAngularTestabilities().findIndex(x=>!x.isStable()) === -1");
1 Like

Thanks Brandon.