I have this problem as well. We have a .Net application and anytime after a deployment, the first run or two for certain tests fail.
There are a few ways to solve the problem, our solution was to build a tool that runs as apart of our deployment process (we call it the Primer) that sends an HTTP request to each web page in our application. We use Ruby with the ‘rest-client’ gem. After this we still noticed a few issues on certain pages. Our hacky solution to this was to setup automatic re-runs (2 additional only running failures) which was pretty easy with ruby/rspec what we use for our UI automation. This was the quickest way we found to have our tests give the developers confidence in the automation.
Now that we have had it running with re-runs for a while we are wanting to find ways to make the failing tests better or to get a better grasp on what is causing those failures and come up with solutions around each scenario. To get there we are building a database where we log test runs, pass/failed, time it took to complete, etc to identify our bottlenecks and those tests that fail often, in hopes to make the runtime shorter.
If anyone else has solved this problem I’d love to hear others. I know our way isn’t the best but it is working.