I'm new to selenium and xpath and I'm trying to check if a span contains certain text, while ignoring the case. I've tried referencing solutions here and here but without success. I have the following:
var driver = new ChromeDriver(DRIVER_LOCATION, options);
string name = "doe, john";
// xpath = "(//span[contains(lower-case(text()), lower-case('doe, john'))][contains(@class, 'token-label')])"
string xpath = $"(//span[contains(lower-case(text()), lower-case('{name}'))][contains(@class, 'token-label')])";
var element = driver.FindElement(By.XPath(xpath));
The the text in the element has "Doe, John" and therefore, fails to find the element. What is the proper way to ignore the case while using contains in xpath for selenium?