Q:

Cannot get text form element

I cannot get text from the element in Selenium. I try to use the following code but get nothing. Xpath helper shows that only one such element.
Code I use:
protected const string ERROR_FORM = "//p[contains(@data-bind, 'invalid')]";

[FindsBy(How = How.XPath, Using = ERROR_FORM)]
 protected IWebElement ErrorForm { get; set; }

public string GetErrorText() {return ErrorForm.Text;}

Html code:
<p class="g-textfield__error" data-bind="if: tokenError() === 'invalid'">Invalid 
code.&nbsp;Check the code&nbsp;you have entered and&nbsp;try again.</p>
<p class="g-textfield__error" data-bind="if: tokenError() === 'expired'"></p>

The problem is found in the previous code. The code was:
public string GetErrorText()
    {
        CustomTestContext.WriteLine("Получить сообщение об ошибке.");

        if (!IsInvalidCodeErrorMessageAppeared())
        {
            throw new XPathLookupException("Произошла ошибка:\n не появилось сообщение об ошибке.");
        }

        return ErrorForm.Text;
    }

    public bool IsInvalidCodeErrorMessageAppeared()
    {
        CustomTestContext.WriteLine("Проверяем появилось ли сообщение об ошибке");
        return Driver.WaitUntilElementIsAppear(By.XPath(ERROR_FORM));
    }

It appeared that I checked the element before it displayed. As soon as I changed Driver.WaitUntilElementIsAppear for Driver.WaitUntilElementIsDisplay the text was found correctly. 
So the thing is that you could not help me as you did not see the full code. Sorry for that, my mistake, I'm too green. Next time I will provide the full code or a link to git rep. I'm greatfull to all of you for trying to help.

A:

Viktor - Here is what mine would look like.... 
    [FindsBy(How = How.XPath, Using = "//p[contains(@data-bind, 'invalid')]")]
    private readonly IWebElement _errorMsgAlert = null;

    public string GetAlertError()
    {
        string errmsg= MyFunctions.GetElementText(_errorMsgAlert);
        return errmsg;
    }

    public static string GetElementText(IWebElement element)
    {
        var text = "";
        while (true)
        {
            try { text = element.Text; }
            catch (StaleElementReferenceException) { }
            return text;
        }
    }

