We have JUnit Serenity project in kotlin for testing of mobile applications.

We are trying to create custom widget element, but we are half-way successful.

Implementation in java - working

@ImplementedBy(MyWidgetJImpl.class) public interface MyWidgetJ extends WidgetObject { public void aaa(); } public class MyWidgetJImpl extends WidgetObjectImpl implements MyWidgetJ { public MyWidgetJImpl(final PageObject page, final ElementLocator locator, final WebElement webElement, final long timeoutInMilliseconds) { super(page, locator, webElement, timeoutInMilliseconds); } @FindBy(xpath = "//*[@id='button_text_title']") private WebElementFacade title; @Override public void aaa() { System.out.println("*********************************" + title.getText()); } }

This element is correctly initialized in PageObject and title is printed.

Implementation in kotlin - not working

@ImplementedBy(MyWidgetKImpl::class) interface MyWidgetK : WidgetObject { fun aaa() } class MyWidgetKImpl(page: PageObject, locator: ElementLocator, webElement: WebElement, timeOut: Long) : WidgetObjectImpl(page, locator, webElement, timeOut), MyWidgetK { @FindBy(xpath = "//*[@id='button_text_title']") private lateinit var title: WebElementFacade override fun aaa() { println("*********************************" + title.text) } }

In this case we are not able to build the project. Build errors are:

Error:(10, 1) Kotlin: MyWidgetKImpl inherits conflicting members: public open fun waitUntilEnabled(): WebElementFacade! defined in net.serenitybdd.core.pages.WidgetObjectImpl, public abstract fun waitUntilEnabled(): T! defined in xx.xx.mobile.framework.xxx.MyWidgetK

28 errors of functions/members from WebElementFacade/WebElementFacadeImpl.

Do you know how to properly implement custom serenity Widget in kotlin?

Or by any chance is there different way to create WebElements with custom functionality?