title: C# Selenium sendkeys
body: <p>I'm trying to submit a list of strings at once rather than individually via a text file, using sendkeys in selenium by findelement.</p>
  
  <p>Example of usage:</p>
  
  <pre><code> driver.FindElement(By.Name("search")).SendKeys(line);
  </code></pre>
  
  <p>What I'm using at the moment is a foreach loop to iterate through the list sending a request with the current line/string individually:</p>
  
  <pre><code>            foreach (String line in File.ReadAllLines(@"input.txt"))
              {
                  string search = line;
  
                  WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
                  IWebElement element = wait.Until(ExpectedConditions.ElementToBeClickable(By.Name("search")));
  
                  if (driver.FindElements(By.Name("search")).Count != 0)
                  {
                      driver.FindElement(By.Name("search")).SendKeys(search);
                  }
  
                  driver.FindElement(By.Name("srchbtn")).Click();
  
                  Results();
              }
  </code></pre>
  
  <p>however the site allows upto 100 strings per search, so rather than sending 1 string each request, I would line to send 100.. How would I extract the first 100 strings from my text file and input them as a list into sendkeys, then the next 100 lines and so on..</p>
  
  <p>I did try:</p>
  
  <pre><code> var Lines = File.ReadLines(@"input.txt").Take(100).ToList();
  
   driver.FindElement(By.Name("search")).SendKeys(Lines);
  </code></pre>
  
  <p>but it returned a error stating:</p>
  
  <pre><code> cannot convert from 'System.Collections.Generic.List&lt;string&gt;' to 'string'
  </code></pre>