>From your log, seems it found three matches. I will use the html you
provided
to create a test case for that.

Thanks,

Jian

On Fri, Mar 4, 2011 at 6:42 PM, Jason <[email protected]> wrote:

> Hmm.  In this case, I have a single exact match for:
>
> div.add_new_article label[for=cmsgData[topic]]
>
> from my UI definition:
>
> ...
>             TextBox(uid:"topicLabel", clocator:[tag:"label",
> for:"cmsgData[topic]"]);
> ...
>
> so given that the jquery selector matches exactly one and only one
> HTML element, should it not be as simple as return the 1 exact match?
> In this case, isElementPresent() returns false the matcher also seems
> confused.  As far as I stil understand, it should find 1 exact match.
> In firebug, $('div.add_new_article label[for=cmsgData[topic]]')
> returns the single element.
>
>
> Jas.
>
>
> On Mar 4, 3:26 pm, Jian Fang <[email protected]> wrote:
> > The matching algorithm will try to find the element with the given
> > attributes. Except for the tag
> > attribute (if it is defined), all other attributes can be relaxed. For
> > instance, I have the UI
> >
> > Container(uid: "test", clocator:[tag: "div", class: "best", type: "d"])
> >
> > The algorithm first tries to find the element with all the attributes,
> i.e.,
> > tag: "div", class: "best", type: "d".
> > If not found, it could reduce the constrain and try
> >
> > tag: "div", class: "best"
> > tag: "div", type: "d".
> > tag: "div"
> >
> > The algorithm will return the matches with most attributes if found
> match.
> > For example, assume we have
> >
> > tag: "div", class: "best" --> no match
> > tag: "div", type: "d". --> 2 matches
> >
> > the the algorithm returns the matched elements for tag: "div", type: "d".
> In
> > this way, you could check what are  the attributes
> > that do not match and adjust your UI module properly.
> >
> > Thanks,
> >
> > Jian
> >
> > On Fri, Mar 4, 2011 at 6:12 PM, Jason <[email protected]> wrote:
> > > In digging around a bit more and changing my UI defintion, I do see
> > > one odd thing:
> >
> > >  [groovyt] -------------------------------------------------------
> > >  [groovyt] discussionEntry.topicLabel: jquery=div.add_new_article
> > > label[for=cmsgData[topic]]
> > >  [groovyt] -------------------------------------------------------
> > >  [groovyt]
> > >  [groovyt]
> > >  [groovyt] UI Module Validation Result for topicLabel
> > >  [groovyt]
> > >  [groovyt] -------------------------------------------------------
> > >  [groovyt]
> > >  [groovyt]     Found Exact Match: false
> > >  [groovyt]
> > >  [groovyt]     Found Closest Match: true
> > >  [groovyt]
> > >  [groovyt]     Match Count: 3
> > >  [groovyt]
> > >  [groovyt]     Match Score: 50
> > >  [groovyt]
> > >  [groovyt]
> > >  [groovyt]     Closest Match Details:
> > >  [groovyt]
> > >  [groovyt]     --- Element topicLabel -->
> > >  [groovyt]
> > >  [groovyt]      Composite Locator: <label for="cmsgData[topic]"/>
> > >  [groovyt]
> > >  [groovyt]      Closest Matched Element:
> >
> > > So I see the match count is 3, which is wrong.  There are indeed 3
> > > labels in the HTML, but the 'for' attribute makes the match more
> > > specific, such that only 1 matches the UI def.  Here's the UI def now:
> >
> > >        public void defineUi() {
> > >                dslContext.ui.Div(uid:this.getName(), clocator:
> > > [class:"add_new_article"]){
> > >                    TextBox(uid:"discussionEntryModuleTitle",
> > > clocator:[tag:"h3"])
> > >            TextBox(uid:"topicLabel", clocator:[tag:"label",
> > > for:"cmsgData[topic]"]);
> > >            InputBox(uid:"topicInput", clocator:[name:
> > > "cmsgData[topic]" ]);
> > >            TextBox(uid:"categoryLabel", clocator:[tag:"label",
> > > for:"cmsgData[category]"])
> > >                        Selector(uid:"discussionCategory", clocator:
> > > [name:"cmsgData[category]"]);
> > >                         TextBox(uid:"errorMessage",
> > > clocator:[class:"errorInput"])
> > >            TextBox(uid:"bodyLabel", clocator:[tag:"label",
> > > for:"cmsgData[description]"]);
> > >            InputBox(uid:"bodyInput", clocator:[class:"mceContentBody
> > > ", id:"tinymce"]);
> > >                        Button(uid:"postDiscussion", clocator: [name:
> > > "submit",
> > > value:dslContext.i18nMessageParser.getExpectedMessage("post.topic")]);
> > >                        Button(uid:"cancelDiscussion",
> > > clocator:[name:"clear",
> > > value:dslContext.i18nMessageParser.getExpectedMessage("cancel")]);
> > >        }
> > >    }
> >
> > > ...
> > > and here's the HTML block getting traversed:
> >
> > > <div id="add_new_article-4281445" class="add_new_article">
> > > <div class="module">
> > >  <div class="content">
> > >    <div class="head">
> > >            <h3>Start a Discussion</h3>
> > >          </div>
> > >    <div class="body">
> > >      <ul>
> > >        <li class="input text">
> > >          <label for="cmsgData[topic]">Discussion Topic Title (100
> > > characters max)</label>
> > >          <input name="cmsgData[slug]" value="" type="hidden">
> > >          <input name="cmsgData[topic]" id="cmsgData[topic]" value=""
> > > class="focused" type="text">
> > >        </li>
> > >                <li class="input select">
> > >          <label for="cmsgData[category]">Discussion Category</label>
> > >          <select name="cmsgData[category]" id="cmsgData[category]">
> > >            <option value="-1">-- Select one --</option>
> > >  <option value="53513">News</option>
> > >  <option value="53514">Fan talk</option>
> > >  <option value="53515">Questions</option>
> >
> > >          </select>
> > >        </li>
> > >        <li class="input textarea">
> > >          <label for="cmsgData[description]">Description</label>
> > >          <textarea style="display: none;"
> > > name="cmsgData[description]" id="cmsgData[description]"
> > > class="mceEditor" rows="12"></textarea><span class="mceEditor
> > > defaultSkin" id="cmsgData[description]_parent"><table style="width:
> > > 530px; height: 190px;" class="mceLayout"
> > > id="cmsgData[description]_tbl" cellpadding="0"
> > > cellspacing="0"><tbody><tr class="mceFirst"><td class="mceToolbar
> > > mceLeft mceFirst mceLast"><a href="#" accesskey="q" title="Jump to
> > > tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path -
> > > Alt-X"><!-- IE --></a><table id="cmsgData[description]_toolbar1"
> > > class="mceToolbar mceToolbarRow1 Enabled" align="" cellpadding="0"
> > > cellspacing="0"><tbody><tr><td class="mceToolbarStart
> > > mceToolbarStartButton mceFirst"><span><!-- IE --></span></td><td><a
> > > id="cmsgData[description]_bold" href="javascript:;" class="mceButton
> > > mceButtonEnabled mce_bold" onmousedown="return false;" onclick="return
> > > false;" title="Bold (Ctrl+B)"><span class="mceIcon mce_bold"></span></
> > > a></td><td><a id="cmsgData[description]_italic" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_italic" onmousedown="return
> > > false;" onclick="return false;" title="Italic (Ctrl+I)"><span
> > > class="mceIcon mce_italic"></span></a></td><td><a
> > > id="cmsgData[description]_underline" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_underline" onmousedown="return
> > > false;" onclick="return false;" title="Underline (Ctrl+U)"><span
> > > class="mceIcon mce_underline"></span></a></td><td><a
> > > id="cmsgData[description]_strikethrough" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_strikethrough"
> > > onmousedown="return false;" onclick="return false;"
> > > title="Strikethrough"><span class="mceIcon mce_strikethrough"></span></
> > > a></td><td><span class="mceSeparator"></span></td><td><a
> > > id="cmsgData[description]_image" href="javascript:;" class="mceButton
> > > mceButtonEnabled mce_image" onmousedown="return false;"
> > > onclick="return false;" title="Insert/edit image"><span class="mceIcon
> > > mce_image"></span></a></td><td><a id="cmsgData[description]_media"
> > > href="javascript:;" class="mceButton mceButtonEnabled mce_media"
> > > onmousedown="return false;" onclick="return false;" title="Insert /
> > > edit embedded media"><span class="mceIcon mce_media"></span></a></
> > > td><td><span class="mceSeparator"></span></td><td><a
> > > id="cmsgData[description]_justifyleft" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_justifyleft" onmousedown="return
> > > false;" onclick="return false;" title="Align left"><span
> > > class="mceIcon mce_justifyleft"></span></a></td><td><a
> > > id="cmsgData[description]_justifycenter" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_justifycenter"
> > > onmousedown="return false;" onclick="return false;" title="Align
> > > center"><span class="mceIcon mce_justifycenter"></span></a></td><td><a
> > > id="cmsgData[description]_justifyright" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_justifyright"
> > > onmousedown="return false;" onclick="return false;" title="Align
> > > right"><span class="mceIcon mce_justifyright"></span></a></td><td><a
> > > id="cmsgData[description]_justifyfull" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_justifyfull" onmousedown="return
> > > false;" onclick="return false;" title="Align full"><span
> > > class="mceIcon mce_justifyfull"></span></a></td><td><span
> > > class="mceSeparator"></span></td><td><a
> > > id="cmsgData[description]_bullist" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_bullist" onmousedown="return
> > > false;" onclick="return false;" title="Unordered list"><span
> > > class="mceIcon mce_bullist"></span></a></td><td><a
> > > id="cmsgData[description]_numlist" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_numlist" onmousedown="return
> > > false;" onclick="return false;" title="Ordered list"><span
> > > class="mceIcon mce_numlist"></span></a></td><td><span
> > > class="mceSeparator"></span></td><td><a id="cmsgData[description]_hr"
> > > href="javascript:;" class="mceButton mceButtonEnabled mce_hr"
> > > onmousedown="return false;" onclick="return false;" title="Insert
> > > horizontal ruler"><span class="mceIcon mce_hr"></span></a></
> > > td><td><span class="mceSeparator"></span></td><td><a
> > > id="cmsgData[description]_link" href="javascript:;" class="mceButton
> > > mce_link mceButtonDisabled" onmousedown="return false;"
> > > onclick="return false;" title="Insert/edit link"><span class="mceIcon
> > > mce_link"></span></a></td><td><a id="cmsgData[description]_unlink"
> > > href="javascript:;" class="mceButton mce_unlink mceButtonDisabled"
> > > onmousedown="return false;" onclick="return false;"
> > > title="Unlink"><span class="mceIcon mce_unlink"></span></a></
> > > td><td><span class="mceSeparator"></span></td><td><a
> > > id="cmsgData[description]_insertdate" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_insertdate" onmousedown="return
> > > false;" onclick="return false;" title="Insert date"><span
> > > class="mceIcon mce_insertdate"></span></a></td><td><a
> > > id="cmsgData[description]_inserttime" href="javascript:;"
> > > class="mceButton mceButtonEnabled mce_inserttime" onmousedown="return
> > > false;" onclick="return false;" title="Insert time"><span
> > > class="mceIcon mce_inserttime"></span></a></td><td><span
> > > class="mceSeparator"></span></td><td><a
> > > id="cmsgData[description]_undo" href="javascript:;" class="mceButton
> > > mce_undo mceButtonDisabled" onmousedown="return false;"
> > > onclick="return false;" title="Undo (Ctrl+Z)"><span class="mceIcon
> > > mce_undo"></span></a></td><td><a id="cmsgData[description]_redo"
> > > href="javascript:;" class="mceButton mce_redo mceButtonDisabled"
> >
> > ...
> >
> > read more ยป
>
> --
> You received this message because you are subscribed to the Google Groups
> "tellurium-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/tellurium-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en.

Reply via email to