Well if those were normal text boxes and such, you'd be fine, even
with events like 'onchange' or whatever associated with them.

Watir doesn't know what to do with a gMed:Control  element, so you'd
have to write custom code to interact specifically with that.

The stuff inside it is fairly normaly looking html other than having
perhaps the largest collection of events I've ever seen tied to a
single HTML element...

Lets see, for the text input box with the id txt_UserName_TextBox  we
have
onfocus
onblur
onkeyup
onKeyDown
onchange
onmouseup
onselect
onpropertychange

So really I think before I did anything, I'd have a developer walk me
through what happens when someone takes a mouse, clicks the box, and
types 'johndoe' into it..   because potentially with all those events
defined, the client side code is literally taking actions on every
single click or keystroke.. (two! per keystroke since it does both
down and up)  and we'd need to know if you have to simulate that at
such an atomic level (sending keydown and keyup events to simulate
every single keypress and release as the name is typed) or if you
might be able to get away with just setting a value in the textbox and
then firing an 'onchange' event.

IF you are lucky putting in the username could be as easy as:

browser.text_field(:id, 'txt_UserName_TextBox').set 'ausername'
browser.text_field(:id, 'txt_UserName_TextBox').fire_event('onchange')

You may be able to work against this, but it's going to help if you
have an intimate understanding of how all the client side code on that
page works so you know what objects and events are critical to making
it dance to your tune, otherwise it's fumble around and try various
stuff to see if anything works. .

For example while I think the textbox control might be relatively
easy, the one right next to it, which looks like some kind of custom
drop down list?  well I don't see any select list there..  now maybe
the scripts that get called cause one to be rendered, and you'd then
be able to find it in the dom and manipulate it, but from what you've
shown us I've no clue what's behind creating some kind of select list
type control in that location.

So to get into more detail,  would take more than just the small html
snippet for me or anyone here to try out a few things and come up with
anything close to a code example.  We'd need to have all the scripting
code that those events call, or better yet a public URL of a site
using this code, in order to try out a few things and see what works



On Jul 1, 11:57 am, SamuelM <[email protected]> wrote:
> I just downloaded Watir to try it out, but I am facing a big issue.  I
> already faced this with Quick Test Professional, and we ended up
> having to write a Web Extensibility for QTP in order to recognize the
> UI controls.
>
> at our organization we created our own custom ui controls, they are
> basically an input field for example, encapsulated in a lot of html,
> and javascript methods to interact with it. (see partial code below.)
>
> So the problem is, how would you ask watir to fill in this form? I
> tried a basic test with the WatirRecorder and it didnt work.
>
> <gMed:Control type="TextBox" id="txtUserName" visible="true"
> acceptButton="" dataField="true" enabled="true"  allowEnter="true"
> mandatory="true" onpropertychange="__TextBoxOnpropertychange();"
> text="" data="" propertyName="UserName" dataName="" readOnly=""
> changed="false" maxLength="30" textMode="SingleLine"><table border="0"
> cellpadding="0" cellspacing="0" class="TextBox" style="WIDTH:100%;
> HEIGHT:20px;DISPLAY: inline; BORDER-COLLAPSE: collapse;">  <tr
> id="txtUserName_Row" class="TextBoxNoFocus" style="" >      <td
> width="100%" height="100%"><input type="text" id="txtUserName_TextBox"
> style="WIDTH:100%; TEXT-ALIGN:left;" maxLength="30"
> class="TextBoxBorderLessNoFocus" onfocus="__AutoTabKeyReset();
> __TextBoxOnFocus('txtUserName');" onblur="__TextBoxOnBlur
> ('txtUserName');" onkeyup="if (this.valid) __AutoTab(); else
> __AutoTabKeyUp();__TextBoxKeyUp('txtUserName');"
> onKeyDown="__AutoTabKeyDown();return __TextBoxKeyDown('txtUserName');"
> value="" onchange="__TextBoxBuild('txtUserName');"
> onmouseup="__TextBoxMouseUp('txtUserName');"
> onselect="__TextBoxSetSelection('txtUserName');"
> onpropertychange="__TextBoxInnerOnpropertychange();" /></td><td
> id="txtUserNameDropDown" style="display: none;" visible=""
> class="TextBoxDropDownButton" valign="top" enabled="true" onclick="if
> (this.enabled.toString()=='true'){__ButtonClick
> ('txtUserNameDropDown');}"></td><td id="txtUserNameAdd"
> class="TextBoxAddButton" valign="top" style="display: none;"
> visible="" enabled="true" onclick="if(this.enabled.toString()=='true')
> {__ButtonClick('txtUserNameAdd');}"></td><td id="txtUserNameRemove"
> class="TextBoxRemoveButtonDisabled" style="display: none;" visible=""
> valign="top" enabled="" onclick="if(this.enabled.toString()=='true')
> {__ButtonClick('txtUserNameRemove');}"></td><td id="txtUserNameSearch"
> class="TextBoxSearchButton" valign="top" style="display: none;"
> visible="" enabled="true" onclick="if(this.enabled.toString()=='true')
> {__ButtonClick('txtUserNameSearch');}"></td><td id="txtUserNameMore"
> class="TextBoxMoreButton" valign="top" style="display: none;"
> visible="" enabled="true" onclick="if(this.enabled.toString()=='true')
> {__ButtonClick('txtUserNameMore');}"></td></tr>     <tr>              <td
> id="txtUserName_ErrorSpan" class="TextBoxError">         </td>     </tr></
> table><script language="javascript">
> document.getElementById('txtUserName').OnFocus =
> document.getElementById('txtUserName_TextBox').focus;
> document.getElementById('txtUserName').SetFocus = SelectControlAndTab;
> document.getElementById('txtUserName').SetCursorAtEnd =
> __TextBoxSetCursorAtEndNoId;
> </script></gMed:Control>
>
> Thank ypu!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to