I am trying to send a string one character at a time. When I try the code below it isn’t working. It says Argument 1: cannot convert from char to string. I know this is probably something simple I am not doing, I just can’t think of what it is.
public void SelectUnit(string unitStr)
{
// Enter the text for the search
new LufasWebManager().Stall(500);
for (int i = 0; i < unitStr.Length; i++)
{
unitTxt.SendText(unitStr[i]);
Thread.Sleep(10);
}
new LufasWebManager().Stall(2000);
// Locate the correct result
var unitSearchResult = driver.FindElement(By.XPath($"//lfs-search-results-drop-list/div/div/div[contains(text(), '{unitStr}')]"));
// And then click it
unitSearchResult.Click();
}
It is not working when I try the unitStr[i].
>Solution :
cannot convert from char to string
So send a string:
unitTxt.SendText(unitStr[i].ToString());