How to write custom keyword in java?

when I click on new keyword it automatically creates custom keyword in groovy. How to write custom keyword in java?

Hi Kalyani,

feel free to write Java code into Groovy keyword, it is absolutely fine. :slight_smile:

1 Like

Thanks for reply. I tried & I got no error while writing custom keyword in java but while calling custom keyword from another test case I am not able to see this custom keyword. My custom keyword code is as below:

@Keyword

public class TakeSnap {

@Snap(“RichFace.png”)

public class RichFace {

private final WebDriver driver;

public RichFace(WebDriver driver) {

this.driver = driver;

}

public OcularResult compare() {

return Ocular.snapshot().from(this)

.sample().using(driver)

.compare();

}

}

}