Is there a way to use XPath expressions with UIpath?

DentsPro Pankow Berlin | Öffnungszeiten | Telefon | Adresse When I try to scrape information from this website, I get an error “cannot find pattern element”. Instead of table extraction can’t I just crawl data with XPath?

Hi,

How about using InjectJsScript activity? (Call javascript code to handle XPath)

Regards,

1 Like

Hi, I am using StudioX, I believe I should pay for using InjectJsScript right?

Hi,

Nope. Can you try to turn on Developer at Filiter of Activities panel, as the following?

image

Regards,

1 Like

(function(element, input) {
    var xpathResult = document.evaluate(input, element, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
    var node = xpathResult.singleNodeValue;
    if (node) {
        return node.textContent;
    } else {
        return null;
    }
})


First of all, thank you for your response. You can see my workflow and the javascript code written by chatgpt, what do you think I am doing wrong?

HI,

This error message shows there is no element which is indicated in InjectJSScipt. (It’s not javascript error but UiPath selector matter)
Can you check if there is target element in the current page?

Regards,

Thank you. You are a saver.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.