I'm building a selenium test using a POM, and I have a List of Webelements (companyNames in SelectAccountPage) that keeps throwing a UninitializedPropertyAccessException.

Here's the Page Object

class SelectAccountPage(driver: WebDriver) {

@FindBy(css = "header h2")
lateinit var selectAccountTitle: WebElement

@FindBy(css = "div[class*='company-picker'] h3")
lateinit var companyNames: List<WebElement>

init {
    PageFactory.initElements(driver, this)

fun pickCompany(companyToSelect: String) {
    for (company in companyNames) {
        if (company.text == companyToSelect) {

and the test

class SignInTest : TestBase() {

    lateinit var signInPage: SignInPage
    lateinit var forgotPasswordPage: ForgotPasswordPage
    lateinit var selectAccountPage: SelectAccountPage

    fun initPageObjects() {
        signInPage = SignInPage(driver)
        forgotPasswordPage = ForgotPasswordPage(driver)
        selectAccountPage = SelectAccountPage(driver)
        assert = SoftAssert()

   @Test(priority = 3)
    fun validCredentials() {
        signInPage.sendCredentials(Config.getUser(), Config.getPassword())

I'm not sure what's going on here because the Webelement on the same page is initialized just fine. Is there something specific that needs to be done when initializing Lists?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.