Closed Bug 488743 Opened 15 years ago Closed 15 years ago

Mozmill Cannot Automate Selection on a XUL menulist element

Categories

(Testing Graveyard :: Mozmill, defect, P1)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: cmtalbert, Assigned: whimboo)

References

Details

(Whiteboard: [verified-mozmill-1.2])

Attachments

(3 files)

<menulist> elements can be used to create a drop down selection list.  The code in Mozmill is currently written against <option> elements in HTML and does not work for <menulist> elements.  

We need a new set of controller functions to select items from <menulist> elements.

I'll attach a test where I have to simulate key commands in order to make the menulist item work.  That is the only work around, and it's not entirely clear that the work around is viable because sometimes the ending <enter> keypress event gets targeted elsewhere than the menulist, causing other behaviors in the system.
We really really need this for 1.2.
Priority: -- → P1
Whiteboard: [mozmill-1.2]
Hardware: x86 → All
Here the modified test which uses the not working select function.
I think we should just check the tagname on the element passed and ifdef this in the select API instead of writing a new API for menulist.
Hardware: All → x86
Hardware: x86 → All
Looks like <menulist> works a bit differently than <options>, adam will have to take a deeper look at this.

https://developer.mozilla.org/en/XUL/menulist
Committed revision 467.

This now works:

var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);

var setupModule = function(module) {
  module.controller = mozmill.getBrowserController();
}

var testPrivacyPanel = function(){
  // load pref pane
  prefcontroller = mozmill.getPreferencesController();

  // load the privacy panel
  prefcontroller.click(new elementslib.Lookup(prefcontroller.window.document, 
                       '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/{"pane":"panePrivacy"}'));

  // Let the UI catch up to us
  //prefcontroller.sleep(400);
  prefcontroller.waitForElement(new elementslib.ID(prefcontroller.window.document, "locationBarSuggestion"));

  // twiddle the drop down
  histDropDown = new elementslib.ID(prefcontroller.window.document, "locationBarSuggestion");
  prefcontroller.select(histDropDown, null, "Bookmarks", null);
  
  prefcontroller.click(histDropDown);
  prefcontroller.keypress(histDropDown, 40, 0, {});
  prefcontroller.keypress(histDropDown, 40, 0, {});
  prefcontroller.keypress(histDropDown, 0, 13, {});
  controller.assertNode(new elementslib.ID(prefcontroller.window.document,
                        "rememberDownloads"));
  controller.assertNode(new elementslib.ID(prefcontroller.window.document,
                        "rememberForms"));
  controller.assertNode(new elementslib.ID(prefcontroller.window.document,
                        "acceptCookies"));
  controller.assertNode(new elementslib.ID(prefcontroller.window.document,
                        "alwaysClear"));
  controller.assertNode(new elementslib.ID(prefcontroller.window.document,
                        "clearDataSettings"));

}
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Blocks: 495448
It's not possible to select the first index or option due to a failure in the parameter checks. I'll attach a patch. Reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #380648 - Flags: review?(adam.christian)
Comment on attachment 380648 [details] [diff] [review]
Follow-up patch for index/option zero

Looks good to me, will go ahead and apply this.
Comment on attachment 380648 [details] [diff] [review]
Follow-up patch for index/option zero

Looks good to me, will go ahead and apply this.
Committed revision 471.
Believe this is now done, marking fixed.
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Attachment #380648 - Flags: review?(adam.christian)
Ok, we have to reopen this bug for at least one more fix. We should not check for undefined as what I proposed in my last patch. We should do something like "if (indx >= 0)" for all those if constructs. Adam can you fix that?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Took Henrik's latest suggestion. Fixed.
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Two checkins were needed because we also have to check value and option. Both landed with:

http://code.google.com/p/mozmill/source/detail?r=485
http://code.google.com/p/mozmill/source/detail?r=486

That should be fine now. Thanks Mikeal.
Status: RESOLVED → VERIFIED
Whiteboard: [mozmill-1.2] → [verified-mozmill-1.2]
We checked in a further patch which doesn't use tagName anymore which depends on the given namespace. localName is the way we should go.

http://code.google.com/p/mozmill/source/detail?r=506

Further note that we cannot automate menulist elements when they are childrens of a panel element. See bug 443155.
Assignee: nobody → hskupin
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: