How to create own TypifiedElement for using it inside HtmlElement?
I created own CustomElement
public class YesNoRadio extends TypifiedElement {
protected YesNoRadio(WebElement wrappedElement) {
super(wrappedElement);
}
.... // some other methods here
}
And tried to use it but got exception on my base page while init Elements
PageFactory.initElements(new HtmlElementDecorator(driver), this);
My exception
ru.yandex.qatools.htmlelements.exceptions.HtmlElementsException: java.lang.NoSuchMethodException: No such accessible constructor on object: com.mycompany.testing.htmlelements.company.element.YesNoRadio
at ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementFactory.createTypifiedElementInstance(HtmlElementFactory.java:51)
at ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementDecorator.decorateTypifiedElement(HtmlElementDecorator.java:102)
at ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementDecorator.decorate(HtmlElementDecorator.java:66)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:115)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:107)
at ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementDecorator.decorateHtmlElement(HtmlElementDecorator.java:115)
at ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementDecorator.decorate(HtmlElementDecorator.java:70)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:115)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:107)
at com.mycompany.testing.cds.PageBase.<init>(PageBase.java:46)
Where is my mistake and how to correct init my own TypifiedElement? Thanks
From the stacktrace, its likely the class from where you're creating the instance of YesNoRadio
is in a different package. Therefore you need to declare the constructor of the latter as public
public YesNoRadio(WebElement wrappedElement) {