Encountering Error 401 with "Get Element" Activity in OpenRPA - Request for Assistance

Hi Skadefro,

I wanted to reach out to you because I encountered an error while using OpenRPA and I was wondering if you could offer some guidance on how to handle it.

I am currently scraping some stores using the “Get Element” activity, but I keep receiving an error 401. I have attached a screenshot of the error message for reference.

I would greatly appreciate it if you could provide me with some advice on how to handle this error using the “Get Element” activity. Any help or suggestions you can offer would be greatly appreciated.

Thank you in advance for your assistance.

https://www.stradivarius.com/tr/en/faux-leather-jacket-with-pockets-l08490182?style=7&colorId=001

That,is not an openrpa error, it is an issue at the server. ( the link does not work for me either )

So how can I handle status codes in “get Element” such as 401, 400, 500?

That is actually a good question. Ill try and come up with a solution tomorrow. Might not be pretty so may need to update openrpa for something userfriendly.

1 Like

I found a way somehow to handle HTTP errors as execute script, what is your recommendation?

(function(){
    
function GetElement(Selector){

function getListOfElementsByXPath(xpath) {
    var result = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null);
    return result;
}
var arr=[];
var results = getListOfElementsByXPath(Selector);
while (node = results.iterateNext()) {
     arr.push(node.textContent.replace(/(\r\n|\n|\r)/gm, "").trim());
}
return arr[0];
    }

var newArr = [];

newArr.push(GetElement("//div[@id='error-information-popup-content']/div[@class='error-code'][contains(text(),'ERROR 410')]"));
newArr.push(GetElement("//div[@id='error-information-popup-content']/div[@class='error-code'][contains(text(),'ERROR 400')]"));
newArr.push(GetElement("//div[@id='error-information-popup-content']/div[@class='error-code'][contains(text(),'ERROR 500')]"))


return(JSON.stringify(newArr.filter((e)=> e !== undefined)));
})();
1 Like

That looks like the best solution for now.
I had hoped the page status would also contain any http response code, but it does not.
So for me to get it from the chrome extension i both need to ask for more permissions AND for all domains, considering how hystiral mozilla and chrome is about extenstions asking for alot of permissions, I’m not really interrested in extenting that right now.
( I have been working on the side on an second addon that uses the system to request permisssions per url instead. This way you cannot just record or call any domain, but once you allow one, I can do anything there. But time has just not been on my time, so progress is slow )

1 Like

Also, we have this case too. I have created my script too handle these errors. Thanks

1 Like

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