title: Convert webelement to string Selenium
body: <p>Hi I am currently trying to run selenium testing for a website, however I am unable to convert the webelement to string. The ErrorMessage 1 = validation which appears, therefore I want ErrorMessage1 = ErrorMessage so I know the test is successful.</p>
  
  <pre><code>public static void main(String[] args) {
  
      System.setProperty("webdriver.chrome.driver",
              "C:\\Users\\lees2\\Downloads\\chromedriver_win32\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.get("http://psage.public.cs.qub.ac.uk/ForgotPassword.aspx");
      driver.manage().window().maximize();
      driver.findElement(By.id("MainContent_Email")).sendKeys("test@test.com");
      driver.findElement(By.name("ctl00$MainContent$BtnSend")).click();
      driver.findElement(By.className("validation-summary-errors"));
      WebElement ErrorMessage1 = driver.findElement(By.className("validation-summary-errors"));
      String ErrorMessage = "\r\n" + "                    Unrecognised email address\r\n" + "                ";
      driver.close();
      if (((String) ErrorMessage1).equalsIgnoreCase(ErrorMessage)) {
          System.out.println("Test successful");
      } else {
          System.out.println("Test failure");
      }
  
  }
  </code></pre>