关于selenium测试获取元素的问题
大家看一下以下的代码,元素标签的内容是由后台生成的,在用selenium测试的时候,for循环内的标签内容总是获取不到,该怎样做呢?使用VS2010编写的测试代码。<script>
var html = '';
$.ajax({
async: false,
url: '/Index/InitMenu',
success: function(data1) {
var data = eval(data1);
for (var item in data) {
if (data.MenuLevel == "1") {
html += "<div title='" + data.MenuName + "' id='menu_" + data.MenuID + "' " + " style='padding: 0px;'></div>";
}
}
$("#Initmenu").append(html);
for (var items in data) {
if (data.MenuLevel == "2") {
$("#menu_" + data.MenuParentLevel).append("<div class='child_menu'><div class='panel-title panel-with-icon menu_li'><span id='menuchild_" + data.MenuID + "' " + "></span><span style='margin-left:5px;'><a href='../" + data.MenuPage + "' " + ">" + data.MenuName + "</a></span></div></div>");
}
}
}
});
</script>
不错
页:
[1]