There are a couple pitfalls when testing more complex websites which use ajax and need to be tested with selenium or phantomjs in order to execute the Javascript in the site. Random test failures and strange errors can happen if the test code doesn't take the asynchronous nature of the test setup into account.