Mozmill Cannot Automate Selection on a XUL menulist element

VERIFIED FIXED

Status

P1
critical
VERIFIED FIXED
10 years ago
2 years ago

People

(Reporter: cmtalbert, Assigned: whimboo)

Tracking

Details

(Whiteboard: [verified-mozmill-1.2])

Attachments

(3 attachments)

(Reporter)

Description

10 years ago
Created attachment 373184 [details]
test demonstrating necessary workaround

<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.
(Reporter)

Comment 1

10 years ago
We really really need this for 1.2.
Priority: -- → P1
Whiteboard: [mozmill-1.2]
Hardware: x86 → All
Created attachment 373206 [details]
Testcase with not working select function

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

Comment 5

10 years ago
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
Last Resolved: 10 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 → ---
Created attachment 380648 [details] [diff] [review]
Follow-up patch for index/option zero
Attachment #380648 - Flags: review?(adam.christian)

Comment 8

10 years ago
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 9

10 years ago
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 10

10 years ago
Committed revision 471.

Comment 11

10 years ago
Believe this is now done, marking fixed.
Status: REOPENED → RESOLVED
Last Resolved: 10 years ago10 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
Last Resolved: 10 years ago10 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.