Selenium error: Command execution failure.

17 views
Skip to first unread message

Paul

unread,
Jul 23, 2009, 2:21:42 PM7/23/09
to tellurium-users
Hey all,

While executing what appears to be a simple test case I am getting the
following error message from selenium

ERROR: Command execution failure. Please search the forum at
http://clearspace.openqa.org for error details from the log window.
The error message is: element.dispatchEvent is not a function

I am trying to have a log file generated by uncommenting the line

logFile = "selenium.log"

in TelluriumConfig.groovy, but for some reason it is still not getting
generated. Maybe its because I am running Selenium externally?

This is the module I am using:

ui.Form(uid: "accountEdit", clocator: [tag: "form", id: "editPage",
method: "post"]){
InputBox(uid: "accountName", clocator: [tag: "input", type:
"text", name: "acc2", id: "acc2"])
InputBox(uid: "accountSite", clocator: [tag: "input", type:
"text", name: "acc23", id: "acc23"])
InputBox(uid: "accountRevenue", clocator: [tag: "input", type:
"text", name: "acc8", id: "acc8"])
TextBox(uid: "heading", clocator: [tag: "h2", text: "%%Account
Edit"])
SubmitButton(uid: "save", clocator: [tag: "input", class: "btn",
type: "submit", title: "Save", name: "save"])
}

and here is the test case:


public void doCreateAccount()
{
type("accountEdit.accountName", "ccc");
click("accountEdit.save");
waitForPageToLoad(30000);
}

I have tried tweaking the module (i.e. swapping out SubmitButton with
Button, changing Form to Container, etc.), but that seems to have no
effect. It appears that it isn't a location problem anyhow though so
maybe the module isn't the issue. I apologize for once again being
unable to post source html due to the policy at my organization.

If anyone has an idea about the problem I'm having I would be very
glad to hear any tips / advice. Thanks for your time.

-Paul


Paul

unread,
Jul 23, 2009, 2:24:22 PM7/23/09
to tellurium-users
While looking online I wasn't able to find too much information about
the particular error I am getting but I did find this post on
stackoverflow:

http://stackoverflow.com/questions/980697/element-dispatchevent-is-not-a-function-js-error-caught-in-firebug-of-ff3-0

I'm not sure if my problem is in any way related to it, but I thought
it couldn't hurt to post.

Thanks,
Paul

On Jul 23, 11:21 am, Paul <bordrguy...@gmail.com> wrote:
> Hey all,
>
> While executing what appears to be a simple test case I am getting the
> following error message from selenium
>
> ERROR: Command execution failure. Please search the forum athttp://clearspace.openqa.orgfor error details from the log window.

Manoj Chavan

unread,
Jul 23, 2009, 2:25:33 PM7/23/09
to telluri...@googlegroups.com
We face a similar problem... due to this.. dont know if it applies to your case.. but worth a try.


"are you using jquery and prototype on the same page by any chance?
If so, use jquery noConflict mode, otherwise you are overwriting prototypes $ function"

Manoj




----- Original Message ----
> From: Paul <bordr...@gmail.com>
> To: tellurium-users <telluri...@googlegroups.com>
> Sent: Thursday, July 23, 2009 11:24:22 AM
> Subject: Re: Selenium error: Command execution failure.
>
>
> While looking online I wasn't able to find too much information about
> the particular error I am getting but I did find this post on
> stackoverflow:
>
> http://stackoverflow.com/questions/980697/element-dispatchevent-is-not-a-function-js-error-caught-in-firebug-of-ff3-0
>
> I'm not sure if my problem is in any way related to it, but I thought
> it couldn't hurt to post.
>
> Thanks,
> Paul
>

Jian Fang

unread,
Jul 23, 2009, 2:58:40 PM7/23/09
to telluri...@googlegroups.com
"XXXX is not a function" is really a general error in Selenium and it does not tell
you what is the real exception, which is why we need exception hierarchy in Tellurium 0.7.0.
 
Make sure you use the latest custom selenium server.

What locators are you using, xpath or jQuery selector? Try both to see if one is working.

If you use Windows system, you  can use Microsoft Script Debugger  to debug
the error.

To debug the javascript code, follow the following step,

1) Start custom selenium server in multiWindow mode

java -jar selenium-server -multiWindow

another useful command option is -debug, which will print out all
trace messages

2) Debug the Java code in IDE and set a break point somewhere in the
code

3) Once the Java process paused, open up the Microsoft script debugger
(or Editor MSE7.exe)
4) Attach you debugger to the running IE instance and you will see the
javascript you want  to debug, set a break point there.
5) Resume you Java process and it will wait there once the breakpoint
is hit in the Javascript  debugger. Then you can step into, step over,
or run the Javascript.

Thanks,

Jian

Jian Fang

unread,
Jul 23, 2009, 3:00:46 PM7/23/09
to telluri...@googlegroups.com
For Tellurium, we used jquery noConflict mode and changed the jQuery name to teJQuery.
Thus, jQuery in the Custom Selenium Server might not be the cause of the problem.

Paul

unread,
Jul 23, 2009, 7:44:03 PM7/23/09
to tellurium-users
Hi Jian,

Thanks for the reply. I will take your advice and see if I can gain
any info from debugging the error.

I am currently using selenium-server-1.0.1-te.jar as this is what I
found in the Tellurium 0.6.0 dependencies folder available on the
download page. Is this the latest version of the custom selenium
server or is there a newer jar out there that I should be using?

Thanks,
Paul

On Jul 23, 11:58 am, Jian Fang <john.jian.f...@gmail.com> wrote:
> "XXXX is not a function" is really a general error in Selenium and it does
> not tell
> you what is the real exception, which is why we need exception hierarchy in
> Tellurium 0.7.0.
>
> Make sure you use the latest custom selenium server.
>
> What locators are you using, xpath or jQuery selector? Try both to see if
> one is working.
>
> If you use Windows system, you  can use Microsoft Script Debugger  to *debug
> *
> the error.
>
> To *debug* the javascript code, follow the following step,
>
> 1) Start custom selenium server in multiWindow mode
>
> java -jar selenium-server -multiWindow
>
> another useful command option is -*debug*, which will print out all
> trace messages
>
> 2) *Debug* the Java code in IDE and set a break point somewhere in the
> code
> 3) Once the Java process paused, open up the Microsoft script debugger
> (or Editor MSE7.exe)
> 4) Attach you debugger to the running IE instance and you will see the
> javascript you want  to *debug*, set a break point there.
> 5) Resume you Java process and it will wait there once the breakpoint
> is hit in the Javascript  debugger. Then you can step into, step over,
> or run the Javascript.
>
> Thanks,
>
> Jian
>
> On Thu, Jul 23, 2009 at 2:21 PM, Paul <bordrguy...@gmail.com> wrote:
>
> > Hey all,
>
> > While executing what appears to be a simple test case I am getting the
> > following error message from selenium
>
> > ERROR: Command execution failure. Please search the forum at
> >http://clearspace.openqa.orgfor error details from the log window.

Paul

unread,
Jul 23, 2009, 8:11:12 PM7/23/09
to tellurium-users
One other thought I had is I am currently running these tests through
Firefox 3.5 via:

browser = "*chrome"

does this custom version of Selenium server support FF 3 ?

Thanks,
Paul

Should I be using an older version of
> > >http://clearspace.openqa.orgforerror details from the log window.

Jian Fang

unread,
Jul 23, 2009, 8:18:54 PM7/23/09
to telluri...@googlegroups.com
Paul,

Yes, that is the version for Tellurium 0.6.0. You may like to try both XPath
and jQuery selector to see if the exceptions are different.

Thanks,

Jian

Jian Fang

unread,
Jul 23, 2009, 8:21:00 PM7/23/09
to telluri...@googlegroups.com
Selenium 1.0.1 supports Firefox 3.5 and the custom selenium server 1.0.1-te also
supports Firefox 3.5. But you can try Firefox 3.0 to see if the exception is still there.

Thanks,

Jian

Harihara Vinayakaram

unread,
Jul 23, 2009, 10:41:22 PM7/23/09
to telluri...@googlegroups.com
Hi
   element.dispatchEvent () is a firefox supported function . Can you run the code in FireFox 3 / 3.5 and see whether firebug reports any errors ?

Regards
Hari

Jian Fang

unread,
Jul 24, 2009, 11:15:33 AM7/24/09
to telluri...@googlegroups.com
I did a reverse engineering to generate html source from your UI module and tested against it.
Seems the UI module does not have any problem for both XPath and jQuery selector. The exception
should be caused by some other things such as Javascript event triggers. As I said, to debug
the JavaScript is the best way for you. For Firefox, you can use Firebug with the same steps I listed.
Make sure to use a Firefox profile so that the Firebug will be included in the launched Firefox instance.

Here are the test code I used:

 public class UserModule extends DslContext {
    public static String HTML_BODY = """
<form id="editPage" method="post">
  <input type="text" name="acc2" id="acc2"/>
  <input type="text" name="acc23" id="acc23"/>
  <input type="text" name="acc8" id="acc8"/>
  <h2>Account Edit </h2>
  <input class="btn" type="submit" title="Save" name="save"/>
</form>
    """
    public void defineUi() {

      ui.Form(uid: "accountEdit", clocator: [tag: "form", id: "editPage", method: "post"]) {
        InputBox(uid: "accountName", clocator: [tag: "input", type: "text", name: "acc2", id: "acc2"])
        InputBox(uid: "accountSite", clocator: [tag: "input", type: "text", name: "acc23", id: "acc23"])
        InputBox(uid: "accountRevenue", clocator: [tag: "input", type: "text", name: "acc8", id: "acc8"])
        TextBox(uid: "heading", clocator: [tag: "h2", text: "%%Account Edit "])
        SubmitButton(uid: "save", clocator: [tag: "input", class: "btn", type: "submit", title: "Save", name: "save"])
      }
    }

    public void doCreateAccount() {
      type "accountEdit.accountName", "ccc"
      click "accountEdit.save"
      waitForPageToLoad 30000
    }
}


public class UserTestCase extends TelluriumJavaTestCase {
    private static MockHttpServer server;

    @BeforeClass
    public static void setUp(){
        server = new MockHttpServer(8080);
        server.registerHtmlBody("/account.html", UserModule.HTML_BODY);
        server.start();
    }

    @Test
    public void testGetSeparatorAttribute(){
        UserModule lm = new UserModule();
        lm.defineUi();
        connectUrl("http://localhost:8080/account.html");
        lm.disableJQuerySelector();
        lm.doCreateAccount();
        connectUrl("http://localhost:8080/account.html");
        lm.useJQuerySelector();
        lm.doCreateAccount();
    }

    @AfterClass
    public static void tearDown(){
        server.stop();
    }
}

Thanks,

Jian

Jian Fang

unread,
Jul 24, 2009, 11:18:43 AM7/24/09
to telluri...@googlegroups.com
Also be aware that "%%" for partial matching is depreciated. You should use the attribute partial matching
prefix '!', '^', '$', or '*' as described at

http://code.google.com/p/aost/wiki/TelluriumjQuerySelector#New_Features_Provided_by_jQuery_Selector

Paul

unread,
Jul 24, 2009, 2:49:55 PM7/24/09
to tellurium-users
Hi Jian,

I have been attempting to debug the problem in the way you mentioned
with Firefox, Firebug, and setting breakpoints in eclipse. The problem
I am facing is I can't seem to find the correct piece of javascript to
set a breakpoint in. I have tried setting breakpoints in numerous
different places, but none of them are getting hit. I have also tried
clicking on the "break on next" button in Firebug, but setting a
breakpoint on that line has no effect either. Finally I have tried
enabling "Break on all Errors" and "Track Throw / Catch", but this
also has had no effect. Am I missing something obvious / is there a
way to figure out where I should place a breakpoint?

One other thing that might be useful is the last command that is run
by Selenium Server before the error is generated is the following:

11:34:13.559 INFO - Command request: mouseOver[jquerycache=
{"uid":"accountEdit.save","locator":"#editPage input.btn[type=submit]
[title=Save][name=save]","unique":true,"optimized":"#editPage input.btn
[type=submit][title=Save][name=save]","cacheable":true}, ] onsession
c85706b196324669aadb0d38d22abcc2

Thanks for all your help so far, I really appreciate it.

-Paul
> On Thu, Jul 23, 2009 at 8:21 PM, Jian Fang <john.jian.f...@gmail.com> wrote:
> > Selenium 1.0.1 supports Firefox 3.5 and the custom selenium server 1.0.1-te
> > also
> > supports Firefox 3.5. But you can try Firefox 3.0 to see if the exception
> > is still there.
>
> > Thanks,
>
> > Jian
>
> >> > > >http://clearspace.openqa.orgforerrordetails from the log window.

Jian Fang

unread,
Jul 24, 2009, 3:19:20 PM7/24/09
to telluri...@googlegroups.com
You are welcome. Try to debug the following two scripts: tellurium.js and tellurium-extensions.js.

Start from the method,

Tellurium.prototype.locateElementByCacheAwareJQuerySelector

since you are using jQuery cache.

If use jQuery without cache, you can start from

Tellurium.prototype.locateElementByJQuerySelector

Let us know what you found.

Thanks,

Jian

Paul

unread,
Jul 24, 2009, 5:16:48 PM7/24/09
to tellurium-users
Hmmm. Maybe I am still doing something wrong, but put breakpoints in
numerous places in both methods you mentioned and they are still being
skipped right over. I came across this page online that says that
Firebug will only break on lines that are inside a function:

http://www.sweetvision.com/2008/02/26/quick-tip-firebug-break-points-not-breaking/

Maybe the reason it's not breaking at my breakpoints is because the
following line:

Tellurium.prototype.locateElementByCacheAwareJQuerySelector = function
(locator, inDocument, inWindow){

is viewed as something other than a function declaration?

-Paul

On Jul 24, 12:19 pm, Jian Fang <john.jian.f...@gmail.com> wrote:
> You are welcome. Try to debug the following two scripts: tellurium.js and
> tellurium-extensions.js.
>
> Start from the method,
>
> Tellurium.prototype.locateElementByCacheAwareJQuerySelector
>
> since you are using jQuery cache.
>
> If use jQuery without cache, you can start from
>
> Tellurium.prototype.locateElementByJQuerySelector
>
> Let us know what you found.
>
> Thanks,
>
> Jian
>
> > > >> > > >http://clearspace.openqa.orgforerrordetailsfrom the log window.
> ...
>
> read more »

Jian Fang

unread,
Jul 24, 2009, 6:18:12 PM7/24/09
to telluri...@googlegroups.com
Tellurium.prototype.
locateElementByCacheAwareJQuerySelector = function
(locator, inDocument, inWindow){
}

is a function declaration. I will try to see if it can stop there.

In the meanwhile, you can try IE to see if you can debug the core there.

Thanks,

Jian
Reply all
Reply to author
Forward
0 new messages