3

I have a simple page that returns an ajax success/error message on submission. The form is submitted using a standard ASP.Net linkbutton.

My Selenium test correctly clicks the linkbutton, however the click event times out and fails. The rest of the testcase conditions pass (as selenium is successfully clicking the link and the ajax success message is displayed).

All I can think is that for some reason click() is calling waitForPageToLoad which is why it is timing out. Is there any way to suppress this, or am I barking up the wrong tree?

Is there an alternative way to handle the click that doesn't care what happens after the event fires?

More Info: Selenium IDE 1.0.2 hosted in Firefox 3.5.2 on Vista (don't ask)

weirdness


Workaround

I've managed to get my test to pass by creating my own click() function in user-extensions.js that does not call Selenium.decorateFunctionWithTimeout(). While my test does pass now, this is not really an ideal solution.

If you'd like to try this yourself, add the following to user-extensions.js (make sure you are referencing this file in your Se:IDE configuration via Tools | Selenium IDE | Options | Options | General | Selenium Core extensions)

Selenium.prototype.doBeatnicClick = function(locator) {
/**
* Clicks on a link, button, checkbox or radio button.
* Hacky workaround for timeout problem with linkbutton.
* Suspect there is an issue with Selenium.decorateFunctionWithTimeout()
*/
var element = this.browserbot.findElement(locator);
var elementWithHref = getAncestorOrSelfWithJavascriptHref(element);

if (browserVersion.isChrome && elementWithHref != null) {

    var win = elementWithHref.ownerDocument.defaultView;
    var originalLocation = win.location.href;
    var originalHref = elementWithHref.href;

    elementWithHref.href = 'javascript:try { '
        + originalHref.replace(/^\s*javascript:/i, "")
        + ' } finally { window._executingJavascriptHref = undefined; }';

    win._executingJavascriptHref = true;

    this.browserbot.clickElement(element);

}

this.browserbot.clickElement(element);

};

Reload Se:IDE and you'll have access to a new command, beatnicClick() which should work where you're experiencing a click() timeout.

Hopefully this will be patched, or fixed in the next release of Se:IDE.

2
  • Can you provide some more detail: target browser, operating system, selenium core or RC? (The image looks like it's from Selenium IDE). Does the script pause until the click has turned red before continuing? Commented Sep 8, 2009 at 3:12
  • Thanks bryan, updated my post with some details. Yes, the script does pause until the click() event fails (or SE:IDE interprets it as failed more accurately.. given that the click event fires!) Commented Sep 8, 2009 at 3:24

2 Answers 2

4

I believe this is raised in the OpenQA Jira: http://jira.openqa.org/browse/SIDE-316. It has also been discussed here: http://clearspace.openqa.org/message/64455

Until the issue has been resolved you can revert to the 1.0b2 version of Selenium IDE http://release.seleniumhq.org/selenium-ide/1.0-beta-2/ but this wont install on Firefox 3.5.x unless you disable extensions.checkCompatability in about:config. See http://kb.mozillazine.org/Extensions.checkCompatibility

Sign up to request clarification or add additional context in comments.

1 Comment

Excellent find Dave - thanks very much. It certainly was feeling like a bug.
0

I was hitting what I assume is this bug when testing a GWT site with Selenium IDE 1.0.2. I just updated to 1.0.4 and don't have it any more.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.