Since selenium Creates a new and clean profile each time you test case runs so follow this process you will get what you want.
1. First you need to create a firefox profile
Close all instances of firefox then using run create a new firefox profile : type firefox - p
2. Install the add-ons whatever you want.
3. set the selenium setFirefoxProfileTemplate to you new firefox profile.
4. Run the test cases . this will use your newly created firefox that will have adons.
How to set the selenium property to use our own firefox profile
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.*;
import com.thoughtworks.selenium.*;
import java.io.File;
public class firefoxprofile extends SeleneseTestCase {
private SeleniumServer seleniumServer;
private Selenium selenium;
public static final String MAX_WAIT_TIME_IN_MS="60000";
@BeforeClass
public void setUp() throws Exception {
File template = new File("C:\\nk");
RemoteControlConfiguration rc = new RemoteControlConfiguration();
rc.setSingleWindow(true);
rc.setFirefoxProfileTemplate(template);
seleniumServer = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "
http://www.google.com/");
seleniumServer.start();
selenium.start();
}
@Test
public void googling() {
selenium.open("/");
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
selenium.type("q", "
http://automationtricks.blogspot.com");
selenium.click("btnG");
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
assertTrue(selenium.isTextPresent("
http://automationtricks.blogspot.com"));
}
@AfterTest
public void tearDown() throws InterruptedException{
selenium.stop();
seleniumServer.stop();
--
Thanks & Regard,
Niraj Kumar