/**
 * @Description: 获取角色管理行索引
 * create time: 2019/3/20
 * params: name:要获取行号的元素名称
 */
public int getRoleIndex(String str,String name){
    int index = 0;
    for (int i = 1; i < 10; i++) {
        String element = getStr(str,i);
        String text= $(By.cssSelector(element)).getText();
        if(text.equals(name)){
            index = i;
            break;
        }
    }
   return index;
}

/**
 * Description:字符串拼接,此方法只支持对{1}进行拼接
 * create by: lixia
 * create time: 2019/3/21
 * params: str:要替换变量的字符串 i:要替换的数字
 */
public String getStr(String str,int i){
    String result=null;
    result=str.replace("{1}",String.valueOf(i));
    return result;
}

//字符串拼接数字,要替换的字符串用{i}代替
public String getStr(String str,int[] list){
    String result=null;
    for (int i = 1; i < list.length; i++) {
        result=str.replace("{"+i+"}",String.valueOf(list[i]));
    }
    return result;
}

/**
 * Description:字符串拼接字符串(多个)
 * create by: lixia
 * create time: 2019/3/21
 * params:
 */
public String getStr(String str,String[] realStr){
    String result=str;
    for(int i=0;i<realStr.length;i++)
        result=result.replace("{"+(i+1)+"}", realStr[i]);
    return result;
}