_generateMiddleSkippedPaths()

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


    _generateMiddleSkippedPaths(x) {
        const parts = x.xpath.split("//").filter((it) => it.length > 0)

        const result = []
        for (let n = 0; n < Math.pow(2, parts.length - 2); n++) {
            let middle = []
            for (let p = 0; p < parts.length - 2; p++) {
                if ((n >> p) % 2 === 1) {
                    middle.push(parts[p + 1])
                }
            }
            let collectedXpath = "//" + parts[0]
            if (middle.length > 0) {
                collectedXpath = collectedXpath + "//"
            }
            collectedXpath = collectedXpath + middle.join("//")
            collectedXpath = collectedXpath + "//" + parts[parts.length - 1]
            result.push(new PrioritizedXpath(collectedXpath, x.priority))
        }
        return result
    }