Home > Selenium, Selenium RC, Selenium Tools > SetUp method for Selenium RC.

SetUp method for Selenium RC.

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
  1. August 16, 2011 at 7:57 pm

    Fantabulous info I should say … Tx Anoop 🙂

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: