|
大家看一下以下的代码,元素标签的内容是由后台生成的,在用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[item].MenuLevel == "1") {
html += "<div title='" + data[item].MenuName + "' id='menu_" + data[item].MenuID + "' " + " style='padding: 0px;'></div>";
}
}
$("#Initmenu").append(html);
for (var items in data) {
if (data[items].MenuLevel == "2") {
$("#menu_" + data[items].MenuParentLevel).append("<div class='child_menu'><div class='panel-title panel-with-icon menu_li'><span id='menuchild_" + data[items].MenuID + "' " + "></span><span style='margin-left:5px;'><a href='../" + data[items].MenuPage + "' " + ">" + data[items].MenuName + "</a></span></div></div>");
}
}
}
});
</script>
|
|