19 Dec 2022 03:38 PM - last edited on 20 Dec 2022 08:43 AM by MaciejNeumann
Hi, I'm attempting to add some javascript to a clickpath to extract the text from an XML Page. I have this working with another clickpath using:
var text = 'An error occured';
var text1 = document.documentElement.innerText;
if (text1.match(/An error occurred/)) {
api.skipNextSyntheticEvent();
} else {
api.info("AUP found");
}
The issue i have is the line:
var text1 = document.documentElement.innerText;
times out when loading the XML Page (JS execution took too long). i've tried innerHTML but this also times out. Is it possible for a click path to do what i want on an XML page?
Solved! Go to Solution.
20 Dec 2022 09:04 AM
Are you able to get the expected text if you interrogate the element in the Console in DevTools?
What size is the response? If you pipe the text1 to the logs - api.info() etc What is the output?
20 Dec 2022 09:19 AM
Hi Hannah,
when i put that in dev tools console i get the text of the page displayed as expected. its 4255 characters long. I've attempted to pipe to api.info and even to api.fail but the script does not reach that point. If the script only contains var text1 = document.documentElement.innerText; it still times out.
20 Dec 2022 11:15 AM
Interesting. Can you go into chat so we can look at this?
20 Dec 2022 11:50 AM
The chat functionailty in the WebUI. That way we can looks at the monitor and page and see what's happening. If you do not have access to chat, you can create a Support ticket
20 Dec 2022 12:29 PM
we dont have chat so i've created a ticket #111989
20 Dec 2022 12:34 PM
Looks like any javascript action times out following the navigation to the XML page. even just
api.info("step 4");
or
api.fail("step 4");
20 Dec 2022 02:28 PM
What version ActiveGate are you running this on? There was a similar sounding issue a while ago, but that was fixed around 1.229.
20 Dec 2022 02:33 PM
20 Dec 2022 03:10 PM
Ah, ok. Unfortunately, there was no workaround and upgrading was the only solution. 😞
20 Dec 2022 03:15 PM
OK, I shall see how it goes when we are updated in the new year. thanks for the help