One problem you might encounter with Selenium is that it will execute your tests pretty fast.<br>This means that if your Selenium test is faster than the process of asynchronously getting some info from the server and updating the page, the test will proceed before the page has changed yielding crap results<br>
One feature Selenium has to help with this are the various wait commands.<br>There are more mentioned in the reference page, but I found this to be useful:<br><br>&lt;tr&gt;<br>    &lt;td&gt;waitForTextPresent&lt;/td&gt;<br>
    &lt;td&gt;Invalid&lt;/td&gt;<br>    &lt;td&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br><br>Selenium will stop at this step until it becomes true. So, in my case, the word Invalid was part of the text appended to the html of the page when a login failed. <br>
This will make Selenium wait until it sees the text Invalid somewhere on the page before proceeding. <br><br>Hope that helps!<br>