硒IDE点击()超时 [英] Selenium IDE click() timeout

查看:137
本文介绍了硒IDE点击()超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的页面,在提交返回阿贾克斯成功/错误信息。形式是使用标准的ASP.Net的LinkBut​​ton提交。

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

我的Selenium测试正确点击LinkBut​​ton的,但click事件超时并失败。测试用例条件合格的其余部分(如硒成功点击链接并显示阿贾克斯成功消息)。

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).

所有我能想到的是,由于某种原因,点击()呼吁waitForPageToLoad这就是为什么它是超时。有什么办法共进晚餐preSS这一点,还是我找错了树?

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?

更多信息:在Vista上的Firefox 3.5.2托管硒IDE 1.0.2(不要问)

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


解决方法

我设法让我的测试在用户extensions.js创建我自己的点击()函数传递,做的不可以调用的 Selenium.decorateFunctionWithTimeout()的。虽然我的测试并通过,现在,这是不是一个真正的理想解决方案。

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.

如果您想这个尝试自己,以下内容添加到用户extensions.js(请确保您要引用您的硒这个文件:通过工具IDE配置|硒IDE |选项|选项|常规|硒核心扩展)

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);

};

刷新硒:IDE,你将有机会获得一个新的命令,beatnicClick()应该在哪里工作,你遇到一个点击()超时

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

希望这会打补丁,或固定在硒的下一个版本:IDE

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

推荐答案

我相信这是在OpenQA吉拉提出:的 http://jira.openqa.org/browse/SIDE-316 。还已经在这里讨论: http://clearspace.openqa.org/message/64455

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

直到问题已得到解决,你可以恢复到硒IDE的 http://release.seleniumhq.org/selenium-ide/1.0-beta-2/ 但除非你是在禁用extensions.checkCompatability这不会在Firefox 3.5.x的安装:配置。请参见 http://kb.mozillazine.org/Extensions.checkCompatibility

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

这篇关于硒IDE点击()超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆