views:

21

answers:

0

Using Windows 2008, C#, Firefox 3.5.1, Selenium RC (v1.0.1)

When it works, this code executes very quickly and the page loads within .5 seconds.

However, the session always seems to fail after 3 - 5 iterations. The open command will cause a window to be spawned, but no page to be loaded. Eventually a timeout exception is returned. The page has not actually timed out. Instead, it is as though the request for a URL has never reached the browser window.

class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                var s = new DefaultSelenium("localhost", 4444, "firefox", "http://my.server");
                s.Start();
                s.SetSpeed("300");
                s.Open("/");
                s.WaitForPageToLoad("30000");
                s.Type("//input[contains(@id, '_username')]", "my.test");
                s.Type("//input[contains(@id, '_password')]", "password");
                s.Stop();

            }
        }
    }