我正在使用Selenium来驱动使用Dojo的网站。由于网站的Dojo网格使用延迟加载,因此我的测试框架很难知道网格是否完成加载。但是,Selenium确实让你注入Javascript。有没有方法可以轮询DOM,或直接使用js来查找网格是否已完成加载?如何确定dojo网格是否已完成加载?
2
A
回答
0
dojox.grid.DataGrid有获取_onFetchComplete设置一个内部标志,所以你可以尝试
var grid = ...
if (grid._isLoaded) {
...
}
0
我发现这个问题,因为我一直在寻找同样的事情。我能得到的最接近的结果是等待Dojo的加载消息消失(如果网格加载速度很快,很难看清楚)。这里是我现在使用的:
/** Required imports **/
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.By;
/** Code snippet **/
WebDriver driver = new FirefoxDriver();
WebDriverWait wait = new WebDriverWait(driver, /* Max wait time */ 30);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(".dojoxGridLoading"));
这让我非常接近。
1
这里是一个伟大的答案,我发现:
grid.connect(grid, '_onFetchComplete', function(){
for(var i in grid._pending_requests){
if(grid._pending_requests[i]){
return; //no, something's not loaded yet.
}
}
//okay, nothing is on the fly now.
});
http://dojo.6188.n7.nabble.com/function-when-the-dataGrid-is-ready-td37563.html
0
这是使用非内部事件 “onStyleRow” 的解决方案:
// Declare myGridLoaded
var myGridLoaded = false;
...
...
// Connect onStyleRow:
dojo.connect(grid, "onStyleRow", grid, function(row) {
if(!myGridLoaded) {
doYourStuff();
// Make sure it runs only once:
myGridLoaded = true;
}
});
// Now set your store and the handler will run only once
// when the first row is styled - if any:
grid.setStore(store);
相关问题
- 1. 如何确定html div元素是否已完成加载
- 2. 如何确定文件是否已完成python下载
- 3. 如何确定文件是否已完成下载
- 4. 如何查找BrowserFrame是否已完成加载网页
- 5. 如何确定CKEditor是否已加载?
- 6. 如何确定UIView是否已加载
- 7. 确定dijit的DOM是否已完成加载
- 8. 如何确定是否SkinnableComponent已完成添加部件?
- 9. 从iframe内部,如何确定父页面是否已完成加载?
- 10. 确定AutoBoxing是否已完成
- 11. 确定javascript是否已完成
- 12. 检查iframe是否已完成加载?
- 13. 如何确定UserControl已完全加载?
- 14. 如何确定Visual Basic中的“WriteAllText”是否已成功完成?
- 15. 确定何时jQuery加载()已完成加载多个图像
- 16. 如何确定定时任务是否已经完成
- 17. 如何使用javascript验证网页是否已完全加载
- 18. 如何确定文件夹是否已完成复制c#
- 19. 如何确定装配是否已经完成?
- 20. 如何判断用户控件是否已完成加载vb6
- 21. 如何检查iframe是否已完成加载
- 22. 如何知道窗口是否已完成加载?
- 23. 如何知道QWebPage是否已完成加载?
- 24. 如何知道“DataTable.Load()”是否已完成加载?
- 25. 如何知道WebBrowser是否已完成加载页面?
- 26. 如何确定AVM1Movie是否完成?
- 27. 如何确定过程是否完成?
- 28. 确定Google Analytics是否已加载
- 29. UIWebView,确定页面是否已加载
- 30. 如何确定网页是否完全在网页浏览器中加载?