O'Reilly logo

Selenium 2 Testing Tools Beginner's Guide by David Burns

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – setting Firefox preferences

Imagine that you wanted to have your site as the startup page for Firefox. To do this we will need to update the browser.startup.homepage preference. Follow these steps:

  1. Let's start by creating the FirefoxProfile object:
    FirefoxProfile profile = new FirefoxProfile();
  2. Now we will set the preference:
    profile.setPreference("browser.startup.homepage", "http://book,theautomatedtester.co.uk");
  3. To get the profile to be used, we need to pass it in to the driver. To do this, we need to do the following:
    driver = new FirefoxDriver(profile);
  4. Run your test. The final code should look like the following:
    public class TestChapter6 { WebDriver driver; @Before public void setUp(){ FirefoxProfile profile = new FirefoxProfile(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required