当我尝试单击“提交”按钮进入下一页时,30000 毫秒后超时
我正在使用java的Selenium RC。在第一页上填写必要的数据-->单击“提交”按钮进入下一页。我的代码是: selenium.click("提交"); selenium.waitForPageToLoad("30000"); 单击“提交”按钮后,我发现错误:com.thoughtworks.selenium.SeleniumException:30000ms后超时
有人可以帮助我吗?
Possible Duplicate:
Timed out after 30000ms when I try to go next page by clicking Submit button
I am using Selenium RC by java.Fill up necessary data on 1st page-->Click Submit button to go next page. My code is:
selenium.click("Submit");
selenium.waitForPageToLoad("30000");
After clicking Submit button I found the error: com.thoughtworks.selenium.SeleniumException: Timed out after 30000ms
Can anybody pls help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这可能是由于互联网连接速度慢造成的。如果页面在指定时间没有完全下载,selenium 服务器会抛出超时错误。当您获得至少 40kB/s 的良好互联网速度时尝试。
This could be because of slow internet connection. If page does not get downloaded fully on the specified time, the selenium server throws timeout error. Try when you get good internet speed of at least 40kB/s.
尝试:
不使用
waitForPageToLoad()
。Try:
without
waitForPageToLoad()
.如果您的表单只是触发一些 AJAX 查询而不是真正的页面加载,那么您就不能等待页面加载,因为从 Selenium 的角度来看,它已经加载了。
If your form just triggers some AJAX query and not real page load, then you can't wait for the page to load, since from Selenium's perspective, it's already loaded.
等待页面上的特定更改要可靠得多。例如,要显示的特定文本或要更改的标题。
如果您绝对需要等待提交并且使用 Ajax,则可以构建 waitForAjax 函数。对于prototype.js,您可以在 http: //davidvollbracht.com/2008/6/4/30-days-of-tech-day-3-waitforajax 和 http://codelevy.com/2007/11/05/selenium-and-ajax-requests。对于 dojo,您可以在 https://i-proving 找到示例.com/space/Dion+Lew/blog/2008-10-23_1。
It's much more reliable to wait for a specific change on the page. For example a specific text to appear or the title to change.
If you absolutely need to wait for submit and you use Ajax, you can build a waitForAjax function. For prototype.js you can find examples at http://davidvollbracht.com/2008/6/4/30-days-of-tech-day-3-waitforajax and http://codelevy.com/2007/11/05/selenium-and-ajax-requests. For dojo you can find an example at https://i-proving.com/space/Dion+Lew/blog/2008-10-23_1.