generatePath()

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


    generatePath() {
        const xpaths = this.generator.generate(this.element).sort(
            function (a, b) {
                if (a.priority === b.priority) {
                    return a.xpath.length - b.xpath.length
                }
                return a.priority - b.priority
            })
        console.log("..............")
        console.log("Unique Locators for " + this.element.getAttribute("class"))
        xpaths.map(locator => console.log(locator.xpath))
        console.log("..............")
        const xpath = xpaths[0]
        if (xpath) {
            this.xpathTextField.value = xpath.xpath
        } else {
            this.xpathTextField.value = `//${this.element.tagName.toLowerCase()}${this.generator._formatAttributes(this.element)}`;
        }
        this.checkXpath()
    }