With the script below i am trying to get the error text from a span error text box for first name when a name is not entered and the user clicks on the submit button, from a registration screen with the HTML below.(<https://www.walmart.com/account/signup>. However I end up just getting none instead of the text. When i try to get the text from chrome console i receive the text with the xpath and css selector as "$x("//span[@class='span-error']")[2]" and "$$(".span-error")[2]". I would like some guidance as to what I am missing, i think have tried everything i can think of.

Test case:

* Get to the link Enter nothing on the first name,Get a validation
error Assert the validation error Enter an invalid name as ":::" Get
a validation error (they seem to have a couple)and so on

[![enter image description here](https://i.stack.imgur.com/jwxJK.png)](https://i.stack.imgur.com/jwxJK.png)

```
from time import sleep
from conftest import os
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

# LoginScreenSelectors
sel_first_name = "#first-name-su"
sel_last_name = "#last-name-su"
sel_email = "#email-su"
sel_password = "#password-su"
sel_error_message = ".span-error:nth-of-type(2)"
sel_submit = f"""[data-automation-id="signup-submit-btn"]"""
sel_required_error = f"""[data-error="required"]"""

class Login():
    '''This will signup to the applcaiton '''

    def __init__(self, driver):
        self.driver = driver
        wait = WebDriverWait(self.driver, 20)
        self.first_name = wait.until(
            EC.presence_of_element_located((By.CSS_SELECTOR, sel_first_name))
        )
        self.last_name = wait.until(
            EC.visibility_of_element_located((By.CSS_SELECTOR, sel_last_name))
        )
        self.email = wait.until(
            EC.visibility_of_element_located((By.CSS_SELECTOR, sel_email))
        )
        self.password = wait.until(
            EC.visibility_of_element_located((By.CSS_SELECTOR, sel_password))
        )
        self.submit = wait.until(
            EC.visibility_of_element_located((By.CSS_SELECTOR, sel_submit))
        )

    def login_to_website(self):
        wait = WebDriverWait(self.driver, 10)
        print(self.driver.title)
        self.first_name.click()
        self.first_name.send_keys("  ")
        self.first_name.send_keys(Keys.TAB)

        self.first_name_error_message = wait.until(
             EC.presence_of_all_elements_located((By.CSS_SELECTOR, sel_error_message))
         )
        type(self.first_name_error_message)
        error_messages = []
        for messages in self.first_name_error_message:
            print(error_messages.append(messages.text))

        #if i could get this then i could simply get the first index and then keep filtering
         it but even that is proving to be difficult.

```