title: How to automate testing whether the elements in a webpage are rendered as expected
body: <p>I'm new to testing frameworks of javascript. I would like to automate testing of few webpages. Quickly going through documentation pages such as casperjs, qunitjs etc.. i can check whether the element with given id or class is there in a webpage.. But how to test whether the elements are rendered as expected. </p>
  
  <p>For example</p>
  
  <ol>
  <li><p>how to check whether the element is shown over on top of all other elements.</p></li>
  <li><p>how to check whether the element position with respect to other element. for example, let's take a contextmenu. on rightclick the contextmenu has to be opened at the position of mouse pointer.. if there is no enough space to accomodate the entire contextmenu it has to either shift to left or right or top or bottom depending on where it can be accomodated. How to automate testing all these things if i write such contextmenu library.</p></li>
  </ol>