Hi Jian,

After more careful observation of the log, I figured out the cause of
the problem. The typeAndReturn command triggers a keyUp event when it
presses the Enter key, however I attached a keyPress event handler for
the album URL input textbox to trigger the data submission. So, I
addressed the problem by attaching a keyUp event handler on the input
textbox so that the typeAndReturn command triggers the data submission
in the automated test.

Thanks for your suggestions.

On Jul 5, 10:03 am, Jian Fang <[email protected]> wrote:
> Hi Gerald,
>
> Since you turned on the default events, the javascript events such as
> "mouseOver", "focus",
> "mouseOut", and "blur" are all added automatically. From your log, you can
> also see clearly
> these events are fired successfully. Have you noticed that the cursor moved
> to the AlbumUrl field?
>
> I suspect that the typeAndReturn may not work in your case because of some
> other javascript events.
> Could you try to use type and add other key actions such keyDown, KeyPress,
> KeyUp, to the response
> attribute:  i.e., respond: ["keyDown", "keyPress", "keyUP"]   to the
> AlbumUrl UI.
>
> Or You can try the keyType method, which adds all the "keyDown", "keyPress",
> and "keyUP" events
>  to each key input.
>
> If possible, please provide the html source for the AlbumUrl field.
>
> Thanks,
>
> Jian
>
>
>
> On Sat, Jul 4, 2009 at 2:30 PM, messidinho <[email protected]> wrote:
>
> > Hi Jian,
>
> > I forgot to mention that I'm running the test using Firefox 3.0. I've
> > tried your suggestion of removing the line i.e. focus "AlbumUrl", but
> > the data doesn't seem to be submitted. The following is part of the
> > Selenium log which looks like it should work, but it doesn't:
>
> > 02:20:35.665 INFO - Command request: mouseOver[//descendant-or-
> > self::button[normalize-space(text())=normalize-space("Add") and
> > @type="button" and @class="gwt-Button"], ] on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.685 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.688 INFO - Command request: fireEvent[//descendant-or-
> > self::button[normalize-space(text())=normalize-space("Add") and
> > @type="button" and @class="gwt-Button"], focus] on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.705 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.707 INFO - Command request: click[//descendant-or-self::button
> > [normalize-space(text())=normalize-space("Add") and @type="button" and
> > @class="gwt-Button"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.744 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.749 INFO - Command request: mouseOver[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumName"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.766 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.769 INFO - Command request: fireEvent[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumName"], focus] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.787 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.790 INFO - Command request: type[//descendant-or-self::input
> > [...@type="text" and @class="gwt-TextBox" and @name="AlbumName"], Monkey
> > Business] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.814 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.817 INFO - Command request: mouseOut[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumName"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.836 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.839 INFO - Command request: fireEvent[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumName"], blur] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.858 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.863 INFO - Command request: mouseOver[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="Artist"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.881 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.888 INFO - Command request: fireEvent[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and @name="Artist"],
> > focus] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.906 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.909 INFO - Command request: type[//descendant-or-self::input
> > [...@type="text" and @class="gwt-TextBox" and @name="Artist"], Black Eyed
> > Peas] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.930 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.933 INFO - Command request: mouseOut[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="Artist"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.952 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.955 INFO - Command request: fireEvent[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and @name="Artist"],
> > blur] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.977 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:35.986 INFO - Command request: mouseOver[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumUrl"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.006 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.009 INFO - Command request: fireEvent[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumUrl"], focus] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.027 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.030 INFO - Command request: type[//descendant-or-self::input
> > [...@type="text" and @class="gwt-TextBox" and @name="AlbumUrl"],
>
> >http://www.amazon.com/Monkey-Business-Black-Eyed-Peas/dp/B00096S3RC/r...
> > ]
> > on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.056 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.060 INFO - Command request: keyUp[//descendant-or-self::input
> > [...@type="text" and @class="gwt-TextBox" and @name="AlbumUrl"], \13] on
> > session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.079 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.082 INFO - Command request: mouseOut[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumUrl"], ] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.100 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.103 INFO - Command request: fireEvent[//descendant-or-
> > self::inp...@type="text" and @class="gwt-TextBox" and
> > @name="AlbumUrl"], blur] on session a16787ba9d7041bfb8432a555b35e01d
> > 02:20:36.126 INFO - Got result: OK on session
> > a16787ba9d7041bfb8432a555b35e01d
>
> > When I manually test it using the Firefox browser, it does submit the
> > data based on my Enter keypress, but using the automated test, it
> > doesn't.
>
> > Thanks,
>
> > Gerald
>
> > On Jul 4, 11:06 pm, Jian Fang <[email protected]> wrote:
> > > Hi,
>
> > > Once you added the respond attribute as respond: [focus], the focus
> > > javascript event
> > > will be automatically triggered when you call
>
> > >  typeAndReturn "AlbumUrl", url
>
> > > and you should not call
>
> > > focus "AlbumUrl"
>
> > > explicitly. As a result, please just remove the above line and see what
> > > happens.
>
> > > Thanks,
>
> > > Jian
>
> > > On Sat, Jul 4, 2009 at 9:01 AM, messidinho <[email protected]> wrote:
>
> > > > I've only had a week of experience with Tellurium and I've just hit a
> > > > brick wall. The following is the code I'm dealing with:
>
> > > > public class ListenMusicAlbumsModule extends DslContext {
> > > >    public void defineUI() {
> > > >        ui.Button(uid: "Add", clocator: [tag: "button", text: "Add",
> > > > type: "button", class: "gwt-Button"])
> > > >        ui.InputBox(uid: "AlbumName", clocator: [tag: "input", type:
> > > > "text", class: "gwt-TextBox", name: "AlbumName"])
> > > >        ui.InputBox(uid: "Artist", clocator: [tag: "input", type:
> > > > "text", class: "gwt-TextBox", name: "Artist"])
> > > >        ui.InputBox(uid: "AlbumUrl", clocator: [tag: "input", type:
> > > > "text", class: "gwt-TextBox", name: "AlbumUrl"], respond: ["focus"])
> > > >    }
>
> > > >        public void addMusicAlbumViaEnterKeyPress(String albumName,
> > String
> > > > artist, String url) {
> > > >                click "Add"
> > > >                type "AlbumName", albumName
> > > >                type "Artist", artist
> > > >                focus "AlbumUrl"
> > > >                typeAndReturn "AlbumUrl", url
> > > >                pause 2000
> > > >        }
> > > > }
>
> > > > I've set "extraEvent = true" in the TelluriumConfig.groovy file as
> > > > follows:
>
> > > > eventhandler{
> > > >        checkElement = false
> > > >        extraEvent = true
> > > > }
>
> > > > What I'm trying to do is test that when the 'Enter/Return' key is
> > > > pressed after typing the album URL, the details get submitted.
> > > > However, the cursor focus remains on the first field, album name.
> > > > Hence, I tried a workaround of setting the cursor focus to be on album
> > > > URL (focus "AlbumUrl") before entering the final field value. The
> > > > problem that I'm having is when I run the TestNG test class, I get the
> > > > following stack trace during the test execution:
>
> > > > groovy.lang.MissingMethodException: No signature of method:
> > > > functional.ListenMusicAlbumsModule.focus() is applicable for argument
> > > > types: (java.lang.String) values: [AlbumUrl]
> > > >        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap
> > > > (ScriptBytecodeAdapter.java:54)
> > > >        at
> > > > org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent
> > > > (PogoMetaClassSite.java:78)
> > > >        at
> > > > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent
> > > > (CallSiteArray.java:44)
> > > >        at
> > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent
>
> ...
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to