I need to create a simple loop that iterates through a list of options in a list container and searches for a specific option. When the text is found it should scroll down to that option so it's visible and then click on it. I came up with something like this:
public static IWebElement FindListItem(IWebElement listContainer, string itemText)
{
List<IWebElement> allOptions = listContainer.FindElements(By.XPath(""));
for (WebElement we: allOptions)
{
dropDown.sendKeys(Keys.DOWN);
sleep(250);
if (we.getText().contains(text)) select.selectByVisibleText("Value1");
}
}
I need this in C#. Can anyone help me with that since my C# skills are just developing.