It’s late and I must be missing something simple here but I just can’t figure it out.
I am attempting to automate the user input of a form using Webdriver. The catch is that the form is dynamic and has lots of custom fields. In this case, I am trying to send a simple string to ALL of the text entry boxes on the form. I think I’m half way there; I am able to pull all text fields using XPath and put them into a List. However, I’m not sure how to interact with them once they are there.. Here is the code I have so far:
List<IWebElement> textfields = new List<IWebElement>();
var test = Driver.FindElements(By.XPath("//*[@type='text']"));
foreach (IWebElement fields in test)
{
textfields.Add(fields);
}
The way in which I interact with WebDriver is something like this:
Driver.FindElements(By.XPath(querygoeshere)).SendKeys("test");.
However, everything in the list is an IWebElement.. What do I do next? Am I on the wrong path here?
I am not sure of the C# syntax, but an approach like this should be helpful: