10

I'm trying to test a Java web app using Selenium 2.16.1. When Selenium opens Firefox, I see a band at the top of the page with message "Will you help improve Mozilla Firefox"

Will you help improve Mozilla Firefox by sending anonymous information about perfomance, hardware characteristics, feature usage, and browser customisations to Mozilla?

For some reason this breaks

selenium.click("id=submit");
selenium.waitForPageToLoad("60000");

which is trying to log in - it becomes a no-op, and the test fails because it's then expecting to have logged in. If I break on the click line and clear the 'will you help' band before continuing then the form submit succeeds.

Is there a way to suppress this band from appearing? (I expect that would mean setting a property in Firefox's default profile - where do I find that?) Or is there a way to get Selenium to spot and dismiss this first? Thanks! I'm using Firefox 9.0.1.


Solved - thanks Danny! Just in case it isn't clear from the answers and comments below:
This was an issue with 2.16.1 and IMO the best solution is to upgrade to 2.17 or later.


Peter points out below that this question is highly ranked for the "Will you help" message itself. If you're looking to disable it:

Community
  • 1
  • 1
Rup
  • 33,765
  • 9
  • 83
  • 112

4 Answers4

6

This is the telemetry feature, and the prompt is controlled by the toolkit.telemetry.prompted property:

https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry

You can set it via prefs.js:

http://kb.mozillazine.org/Prefs.js_file

Also relevant:

http://code.google.com/p/selenium/issues/detail?id=3144

Danny Thomas
  • 1,879
  • 1
  • 18
  • 32
  • Thanks. IIRC Selenium creates a completely clean profile for each session. I can jump through a few hoops to make a template profile and get it to use that but I was hoping for a way to set that as a global default so I wouldn't have to. However the last link is promising: it sounds like a snapshot Selenium build will just work as-is. I'll give that a go when I'm back in the office tomorrow. – Rup Jan 10 '12 at 00:08
  • 1
    This looks like it might help too: http://girliemangalo.wordpress.com/2009/02/05/creating-firefox-profile-for-your-selenium-rc-tests/ – Danny Thomas Jan 10 '12 at 14:08
3

The link referenced by @Danny Thomas is now out of date (it only applies to Firefox 6/7/8).

To get rid of the prompt, add the following lines to prefs.js in your firefox user profile directory.

user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.prompted", 2);
user_pref("toolkit.telemetry.rejected", true);

Note that the prompted setting has changed from 'False' to '2'.

Note: This also applies to the Firefox ESR product (tested on 10.0.5).

Source : http://developers.sugarcrm.com/wordpress/2012/01/23/howto-disable-the-mozilla-firefox-telemetry-feature/

Peter Bernier
  • 8,038
  • 6
  • 38
  • 53
  • Thanks. However that wasn't the solution I used: as we went on to discuss in comments - which is what I accepted his answer for - IMO the best way was to upgrade Selenium to the latest version so it can deal with the dialog itself. – Rup Jun 06 '12 at 22:11
  • True, but since this question is currently the top google result for the telemetry text, people may be coming here (myself included) that aren't looking to resolve an issue using Selenium. – Peter Bernier Jun 07 '12 at 13:37
1

I was also facing same problem. Solution for this is Use latest Selenium Server jar file (selenium-server-standalone.jar). So it will work properly with latest firefox version and at the top of the page "Will you help improve Mozilla Firefox" message will not be displayed.

Prashant Vadher
  • 1,057
  • 11
  • 9
1

I found out a little workaround. Use:

    WebDriver driver;
    ...
    WebElement elem = driver.findElement(By.id("submit"));
    elem.sendKeys(Keys.RETURN);

it's like hitting "Enter" after getting to the element with the Tab key.

Danny

Daniel
  • 754
  • 1
  • 11
  • 25
  • Thanks - that's interesting. It might well be worth setting up a test to make sure we can log in using 'enter' like that, but I don't want to start changing the way we click buttons in all of our tests just to cope with a Selenium/Firefox interop issue. – Rup Jan 11 '12 at 14:37
  • I tried creating FF profiles, following everything on the above links, including changing parameters using `about:config`. However - it seems that Selenium gets its profile from a different place. The first answer worked for you? – Daniel Jan 12 '12 at 06:42
  • The bit that worked for me was the bottom link in the first answer: it's fixed in trunk. I built myself a snapshot selenium from their source control and that worked - annoyingly their CI server hasn't been running for months so you need to do it yourself. If you want to use a custom profile with Selenium then you need to specify it on the command line when you start the selenium server jar; I've used that before to get NTLM logins with Selenium at least so I expect it'd work for this but I haven't tried it. Not sure how to configure that for Selenium inside Eclipse (which is what I'm using) – Rup Jan 12 '12 at 09:37
  • Here's [my snapshot build from a few days ago](http://rupertwood.com/temp/selenium-2.0-SNAPSHOT-20120110.zip). This is a zip from my local maven repository cache - if you're using maven then you should be able to unzip it into the repository directory then access it as version 2.0-SNAPSHOT as usual. I'm afraid the android build failed so it definitely doesn't support that, and I haven't tested it on anything other than firefox. – Rup Jan 12 '12 at 09:40
  • I download the snapshot on the link you gave. It may be a bad practice - but usually I run (`java -jar selenium-server-standalone-2.16.1.jar`) and then start my java tests, using `selenium-java-2.16.1.jar`. It seems that the jar under selenium-server causing java null pointer exception upon execution. Maybe it'll work if I'll use maven. – Daniel Jan 14 '12 at 09:23
  • Sorry, been away for the week. That's probably one of the dependencies that failed to build for me. It won't be maven, but the eclipse integration which must be starting the server differently (explicitly specifying the browser engine?). However [they've released 2.17 now](http://seleniumhq.org/download/) though so this is all moot - the release should just work. – Rup Jan 23 '12 at 09:18