//First class citizen
class EnvironmentBlock extends HtmlElement {
@FindBy(className="js-navigate")
var nameEl:Link = null
@FindBy(className="js-environment-item-edit")
var editEl:Link = null
@FindBy(className="js-environment-item-delete")
var deleteEl:Link = null
def Name = nameEl.getText
}
abstract class EnvironmentsPage {
@FindBy(className="environment-item")
var environments:java.util.List[EnvironmentBlock] = null
}
Doesn't work
abstract class EnvironmentsPage {
//!!!here EnvironmentBlock is nested!!!
class EnvironmentBlock extends HtmlElement {
@FindBy(className="js-navigate")
var nameEl:Link = null
@FindBy(className="js-environment-item-edit")
var editEl:Link = null
@FindBy(className="js-environment-item-delete")
var deleteEl:Link = null
def Name = nameEl.getText
}
@FindBy(className="environment-item")
var environments:java.util.List[EnvironmentBlock] = null
}
Throws on
val environmentsPage = {
val page = new EnvironmentsPage { val driver = ... }
HtmlElementLoader.populatePageObject(page, driver)
page
}
Log
[info] ru.yandex.qatools.htmlelements.exceptions.HtmlElementsException: java.lang.InstantiationException: XXX.EnvironmentsPage$EnvironmentBlock
[info] at ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementFactory.createHtmlElementInstance(HtmlElementFactory.java:37)
[info] at ru.yandex.qatools.htmlelements.loader.decorator.proxyhandlers.HtmlElementListNamedProxyHandler.invoke(HtmlElementListNamedProxyHandler.java:40)
If this quite technical limitation for now (according to my limited knowledge of nested classes), it would be good to notice that on start page, because error log is confusing.
P.S. It would be nice to notice that on Read.me that List are supported aswell
P.P.S. I didn't get when and why I should use @Name anotation
Used version: 1.9-Snapshot
Sorry for scala syntax... however.
Works fine:
Doesn't work
Throws on
Log
If this quite technical limitation for now (according to my limited knowledge of nested classes), it would be good to notice that on start page, because error log is confusing.
P.S. It would be nice to notice that on Read.me that List are supported aswell P.P.S. I didn't get when and why I should use
@Name
anotation