Last Comment Bug 568961 - Need a function to clear a textbox
: Need a function to clear a textbox
Product: Testing Graveyard
Classification: Graveyard
Component: Mozmill (show other bugs)
: Trunk
: All All
-- enhancement
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on:
  Show dependency treegraph
Reported: 2010-05-28 14:41 PDT by Marc-Aurèle DARCHE
Modified: 2016-08-24 09:02 PDT (History)
3 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Description User image Marc-Aurèle DARCHE 2010-05-28 14:41:12 PDT
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
Comment 1 User image Henrik Skupin (:whimboo) [away 02/18 - 02/27] 2010-05-28 14:46:43 PDT
This function could do the following:

keypress: select all
keypress: delete
Comment 2 User image Andrew Halberstadt [:ahal] 2011-02-15 12:06:48 PST
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.
Comment 3 User image Henrik Skupin (:whimboo) [away 02/18 - 02/27] 2011-02-15 12:50:22 PST
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 User image cmtalbert 2011-03-01 13:58:20 PST
wontfix per comment 3, which I agree with.
Comment 5 User image Marc-Aurèle DARCHE 2011-07-14 09:02:49 PDT
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?
Comment 6 User image Marc-Aurèle DARCHE 2011-07-30 02:23:39 PDT
(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
Comment 7 User image Henrik Skupin (:whimboo) [away 02/18 - 02/27] 2014-12-17 01:38:25 PST
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.

Note You need to log in before you can comment on or make changes to this bug.