title: Consume a concat() XPath in Selenium and retrieve the text
body: <p>I am using one of the many XPath built-in functions (concat) to concatenate multiple elements on the page into a single string. </p>
  
  <p>I want to consume this string in Selenium but I get an error when consuming the XPath. Here is the setup:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;table&gt;
    &lt;thead&gt;
      &lt;th&gt;Thing One&lt;/th&gt;
      &lt;th&gt;Thing Two&lt;/th&gt;
    &lt;/thead&gt;
    &lt;tr&gt;
      &lt;td&gt;One&lt;/td&gt;
      &lt;td&gt;Two&lt;/td&gt;
    &lt;/tr&gt; 
  &lt;/table&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>XPath</strong><br>
  <code>concat(//table//tr[1]/td[1], //table//tr[1]/td[2])</code></p>
  
  <p><strong>XPath Result</strong>  (works)   </p>
  
  <p>"OneTwo"</p>
  
  <p><strong>Consuming in Selenium:</strong></p>
  
  <pre><code>string xpath = "concat(//table//tr[1]/td[1], //table//tr[1]/td[2])"
  OpenQA.Selenium.By MyBy = OpenQA.Selenium.By.XPath(xpath);
  IWebElement element = Engine.WebDriver.FindElement(MyBy);
  string text = element.Text;
  </code></pre>
  
  <p>An exception is thrown on the third line:</p>
  
  <p><em>"OpenQA.Selenium.InvalidSelectorException: 'Unable to locate an element with the xpath expression concat(//table//tr[1]/td[1], //table//tr[1]/td[2]) because of the following error:
  Error: value could not be converted to the specified type'"</em></p>
  
  <p>I would like to be able to consume the result of this XPath in Selenium.</p>
  
  <p><strong>*Update:</strong></p>
  
  <p><strong>Use Case</strong><br>
  I'm building a utility which gets the values in the cells of a table (either across column or row). I need to run a contains() or startsWith() analysis on every cell. Instead of building a List and converting each element to Text, which takes a long time, I want to get a list of string for all the values and run through it programatically to find the indices for the matches. Knowing the indices of the matches I can then generate only the IWebElements that match.  </p>