title: How to verify the title in selenium webdriver
body: <p>I tried to verify title in home page, I have tried below these two methods but I got error.</p>
  
  <p>1.</p>
  
  <pre><code>WebDriverWait wait=new WebDriverWait(driver,30);       
  wait.until(ExpectedConditions.titleContains("This is demo site for"));
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code>Timed out after 30 seconds waiting for title to contain "This is demo site for". Current title: "Home page"
  Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>String actualTitle=driver.getTitle();
  String expectedTitle="This is demo site for";
  assertEquals(actualTitle, expectedTitle);
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code>org.junit.ComparisonFailure: expected:&lt;[Home page]&gt; but was:&lt;[This is demo site for]&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="page-title"&gt;
    &lt;h2&gt;
      This is demo site for
      &lt;img alt="" src="image link here"&gt;&lt;/img&gt;
    &lt;/h2&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The above one is DOM of that page title. I don't know how to use this element, please any one can help me.</p>