TrailbreakerMinimal/ChromeExtension/content.js
//because there may be an element directly behind it which does!
because there may be an element directly behind it which does!
because there may be an element directly behind it which does!
function findBestSelector(element) {
    var id = element.getAttribute("id");
    var name = element.getAttribute("name");
    var cname = element.getAttribute("class");
    if (id == null && name == null && cname == null) {
        findBestSelector(element.parentNode);
    } else {
        if (id != null) {
            return "By.Id(\"" + id + "\")";
        }else if (name != null) {
            return "By.Name(\"" + name + "\")";
        }else if (cname != null) {
            return "By.ClassName(\"" + cname + "\")";
        }
    }
    return "BROKEN SELECTOR!";
}
function findBestSelector ( element ) { var id = element . getAttribute ( "id" ) ; var name = element . getAttribute ( "name" ) ; var cname = element . getAttribute ( "class" ) ; if ( id == null && name == null && cname == null ) { findBestSelector ( element . parentNode ) ; } else { if ( id != null ) { return "By.Id(\"" + id + "\")" ; } else if ( name != null ) { return "By.Name(\"" + name + "\")" ; } else if ( cname != null ) { return "By.ClassName(\"" + cname + "\")" ; } } return "BROKEN SELECTOR!" ; }
because there may be an element directly behind it which does!
because there may be an element directly behind it which does!
//        alert("Got |" + id + name + cname + "|");