title: Selenium WebDriver get text from CSS property "content" on a ::before pseudo element
body: <p>I am trying to verify the text "The information provided is either invalid or incomplete." is displayed using Selenium/WebDriver in Java.</p>
  
  <p>I have the following HTML:</p>
  
  <pre><code>&lt;div id="validationError"&gt;
      &lt;ul&gt;
          &lt;li&gt;Required: Server Name&lt;/li&gt;
          &lt;li&gt;Required: Receiving Port&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>with the following CSS code:</p>
  
  <pre><code>#validationError:before {
      content: 'The information provided is either invalid or incomplete.';
  }
  </code></pre>
  
  <p>Here's my current java code:</p>
  
  <pre><code>WebElement errorBox = browser.findElement(By.id("validationError"));
  Assert.assertNotNull("Could not find validation errors", errorBox);
  
  System.out.println("Error Explanation: " + error.getCssValue("content") + "\n");
  
  List&lt;WebElement&gt; errorList = errorBox.findElements(By.tagName("li"));
  for (WebElement error : errorList) {
      System.out.println("Error: " + error.getText());
  }
  
  System.out.println("\nError Full Text: " + errorBox.getText());
  </code></pre>
  
  <p>This is my output of the above code:</p>
  
  <pre><code>Error Explanation:
  
  Error: Required: Server Name
  Error: Required: Receiving Port
  
  Error Full Text: Required: Server Name
  Required: Receiving Port
  </code></pre>
  
  <p>I can't seem to find a way to verify the text "The information provided is either invalid or incomplete." is displayed. Calling <code>getText()</code> on the web element also does not return the expected string, but will display any other normal text within that div. Any ideas?</p>