Javascript 如何在浏览器中获取Ext js元素id或itemId值
外部视图页面Javascript 如何在浏览器中获取Ext js元素id或itemId值,javascript,php,html,extjs,sencha-cmd,Javascript,Php,Html,Extjs,Sencha Cmd,外部视图页面 text : ACTIONS, xtype : 'actioncolumn', draggable: false, dataIndex: 'message', items: { [ { glyph:'xf044@FontAwesome', name : 'edit_customer', handler: function(grid, rowIndex, colIndex, item, event, record, row)
text : ACTIONS,
xtype : 'actioncolumn',
draggable: false,
dataIndex: 'message',
items:
{
[
{
glyph:'xf044@FontAwesome',
name : 'edit_customer',
handler: function(grid, rowIndex, colIndex, item, event, record, row)
{
this.up("customer-list").getController().EditCustomer(record);
},
}
]
}
HTML输出:
<span role="button" title=""
class="x-action-col-icon x-action-col-glyph x-action-col-6 x-hide-display"
style="font-family:FontAwesome"
data-qtip="Edit Customer"></span>
但我需要在这里拿到我的身份证
如果刷新页面,按钮id将显示差异编号
例如:id=“tableview-1738”
所以,我怎样才能直接从html页面获取id或任何属性呢。
我需要在这个元素中测试automatic,ExtJS中的id是动态的。因此,您必须使用标签字符串或网页设计来获取元素。下面是根据标签和字段类型获取元素id的代码
private static String getID(WebDriver driver, String elementText, String field_type, Integer occurence) throws InterruptedException {
String pageSource = driver.getPageSource();
String regX = "<" + field_type + " id=\"([^\"]+)\" [^>]+>" + elementText + "<\\/" + field_type + ">";
Pattern id = Pattern.compile(regX);
Matcher match = id.matcher(pageSource);
int count = 0;
while (count < occurence) {
count++;
match.find();
switch (field_type) {
case "label":
returnID = match.group(1).replace("label", "input");
break;
case "span":
returnID = match.group(1).replace("btnInnerEl", "btnIconEl");
break;
}
}
return returnID;
}
ExtJS中的id是动态的。因此,您必须使用标签字符串或网页设计来获取元素。下面是根据标签和字段类型获取元素id的代码
private static String getID(WebDriver driver, String elementText, String field_type, Integer occurence) throws InterruptedException {
String pageSource = driver.getPageSource();
String regX = "<" + field_type + " id=\"([^\"]+)\" [^>]+>" + elementText + "<\\/" + field_type + ">";
Pattern id = Pattern.compile(regX);
Matcher match = id.matcher(pageSource);
int count = 0;
while (count < occurence) {
count++;
match.find();
switch (field_type) {
case "label":
returnID = match.group(1).replace("label", "input");
break;
case "span":
returnID = match.group(1).replace("btnInnerEl", "btnIconEl");
break;
}
}
return returnID;
}
你想进入处理函数吗?不,我不想让ant函数只在inspect元素中获取id平均id值抱歉,我没有在ExtJS中获取你的id是动态的。你最好看看这个问题:你想进入处理函数吗?不,我不想让ant函数只在inspect元素中获取id平均id值抱歉,我没有在ExtJS中获取你的id是动态的。你最好看看这个问题: