Need a function to clear a textbox



9 years ago
3 years ago


(Reporter: mozdev, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [MozMillAddonTestday][mozmill-2.0-], URL)



9 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr; rv: Gecko/20100401 Firefox/3.6.3
Build Identifier: 

A new method in the Mozmill Controller Object to blank a textbox, without having to use the controller keypress method with 'VK_BACK_SPACE' for each letter, would be much welcome.

The keypress method is effective only on the input of the textfield element, which is impossible to get through the element id, one has to resort to use a mochi path. That's why this new blanking method should be given the textfield element, just like the type method.

Reproducible: Always
This function could do the following:

keypress: select all
keypress: delete
Ever confirmed: true
Summary: Add a Textbox blanking method in the Mozmill Controller Object → Need a function to clear a textbox
Whiteboard: [MozMillAddonTestday]
Whiteboard: [MozMillAddonTestday] → [MozMillAddonTestday][good first bug]
I'm not sure if this is worthy of a new controller method.  Maybe we can pass in an optional flag to the type method which tells it to either append to the text box or overwrite it.

So you could do:
controller.type(textbox, '', true)

to clear it.
Whiteboard: [MozMillAddonTestday][good first bug] → [MozMillAddonTestday][good first bug][mozmill-2.0?]
I would more tend to say a wontfix. If you want to work on an empty textbox, clear it first. I don't see a reason to bundle that into type(). With our refactoring of the shared modules it will also be much clearer.

Comment 4

8 years ago
wontfix per comment 3, which I agree with.
Last Resolved: 8 years ago
Resolution: --- → WONTFIX
Whiteboard: [MozMillAddonTestday][good first bug][mozmill-2.0?] → [MozMillAddonTestday][mozmill-2.0-]

Comment 5

8 years ago
We can't expect developers to come up with the following code which is not straightforward at all:

  var utils = require('../../../../lib/utils');
  var select_all_key = utils.getEntity(['chrome://browser/locale/browser.dtd'],
  controller.keypress(elem, select_all_key, { accelKey: true });
  controller.keypress(elem, 'VK_DELETE', {});

The fact that this code is used in tests/addons/ through the "clearBaseURLField" method as well as in the fidesfit-client extension advocates for its factoring out.

So reopening.

Could we add this method in mozmill-tests/lib/utils.js please?
Resolution: WONTFIX → ---

Comment 6

8 years ago
(In reply to comment #5)
> Could we add this method in mozmill-tests/lib/utils.js please?

I will gladly provide a patch once I have your agreement on the interest of such a method.

Thank you
Mozmill will reach its end of life soon. We are currently working on getting all the tests for Firefox ported to Marionette. For status updates please see bug 1080766.
Last Resolved: 8 years ago4 years ago
Resolution: --- → WONTFIX
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.