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?


2 Answers 2


You most probably already found an answer, but I am leaving it just in case somebody else came across this problem, as I did to today.

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

Changing code as above did the trick for me.


Use MutableList instead of List

so you will have:

lateinit var companyNames: MutableList<WebElement>

  • 1
    Could you please edit this answer to explain why MutableList<WebElement> will work better for the OP than List<WebElement>.
    – Kate Paulk
    Commented Oct 18, 2022 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.