_isGoodAndUnique()

in robot-server-plugin/src/main/resources/static/xpathEditor.js [210:232]


    _isGoodAndUnique(x, element) {
        if (/\r|\n/.exec(x.xpath)) {
            return false
        }
        if (/[a-zA-Z;$0-9]{2,30}@[a-z0-9A-Z]{3,20}/.exec(x.xpath)) {
            return false
        }
        if (/@onclick/.exec(x.xpath)) {
            return false
        }
        if (/[=,][ ]?'[a-zA-Z$.]{0,200}[0-9]{1,5}'/.exec(x.xpath)) {
            return false
        }
        if (/[=,][ ]?'[^a-z^A-Z]{1,20}'/.exec(x.xpath)) {
            return false
        }
        try {
            return document.evaluate("count(" + x.xpath + ")", document, null, XPathResult.ANY_TYPE, null).numberValue === 1
                && document.evaluate(x.xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue === element
        } catch (e) {
            return false
        }
    }