title: Selenium 2 WebDriver to use Custom Profile
body: <p>I'm trying to automate the interaction with a website that generates documents with MIME type application/vnd.wap.xhtml+xml. I am using Selenium 2, the WebDriver and the FirefoxProfile.</p>
  
  <p>Because Firefox does not handle the above mentioned MIME type, I need to run Firefox with the XHTML Mobile Profile extension (https://addons.mozilla.org/en-US/firefox/addon/1345/). </p>
  
  <p>After creating a FireFox profile -I named it 'selenium'- and installing the Mobile Profile extension, I tried to use the code snippets in the 'Tips and Tricks' section of the 'Selenium 2.0 and WebDriver' document (http://seleniumhq.org/docs/09_webdriver.html#htmlunit-driver). </p>
  
  <p>Approach #1 looks like this:</p>
  
  <pre><code>ProfilesIni allProfiles = new ProfilesIni();
  FirefoxProfile profile = allProfiles.getProfile("selenium");
  profile.setPreference("general.useragent.override", "User Agent string to force application/vnd.wap.xhtml+xml content..");
  FirefoxDriver driver = new FirefoxDriver(profile);
  driver.get("http://www.mobilesite.com/");
  WebElement element = driver.findElement(By.tagName("body"));
  </code></pre>
  
  <p>Approach #2 looks like this:</p>
  
  <pre><code>File profileDir = new File("/path/to/custom/profile/with/extension/ffprofile");
  FirefoxProfile profile = new FirefoxProfile(profileDir);
  profile.setPreference("general.useragent.override", "same user agent string as above");
  FirefoxDriver driver = new FirefoxDriver(profile);
  driver.get("http://www.mobilesite.com/");
  </code></pre>
  
  <p>No matter what code snippet I use, the browser instance that starts up is always unable to handle the generated content; the browser prompts me for an action to take on the content of the unrecognized MIME type as if the extension was not correctly configured.</p>
  
  <p>Any ideas on what I could be doing wrong?</p>
  
  <p>Thanks in advance,</p>
  
  <p><strong>Edit</strong>: <a href="http://groups.google.com/group/selenium-users/browse_thread/thread/a9fbb551d1d2cf53/f7ddea0c896a8187?lnk=gst&amp;q=selenium%202%20webdriver%20profile&amp;pli=1" rel="nofollow">Link to Selenium users group post</a>.</p>