Archive

Posts Tagged ‘selenium.start’

SetUp method for Selenium RC.

June 29, 2011 1 comment

We can write setup method for Selenium RC in different ways.

1. Initialize the selenium server for test classes after starting the selenium server manually.

2. Initialize and Start selenium server from the code itself.

If we use TestNG framework we can write this setup method as BeforeClass.

Sample code for first method

@BeforeClass
    public void testsetUp() throws Exception
    {
        selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, BaseUrl);
        selenium.start();
         selenium.open(“/”);
        
    }

Sample code for second method

@BeforeClass

public void SetUp(String url, String browser) throws Exception
    {
         SeleniumServer seleniumserver = new SeleniumServer();
        seleniumserver.boot();
        seleniumserver.start();
        setUp(url, browser);
        selenium.open(“/”);
    }

Advertisements
%d bloggers like this: