cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Javascript Fragment is not working BP 7.3

mengjie.he
Level 3

Hi All,

brief summary:

We are updating the bp from 7.0.2 to 7.3, and with that, and we got the javascript functions affected.

We took the following two steps by referring to the document [Blue Prism Blue Prism Onboarding(2024/03)].

https://pages.blueprism.info/rs/544-MLV-234/images/JP-Blue-Prism-Onboarding_202403.pdf

  • The object must have a debug port specified in the URL for launching the browser (therefore attaching to a browser won't work - unless the browser was previously launched with a debug specified)
  • The right version of the web driver for the browser in question (either Chrome or Edge) should be installed onto the machine on which the automation will run

But only Invoke Javascript Function worked properly, Insert Javascript Fragment did not work. 

My issue:
Now, we want to insert cutsom event on Page. How can Insert Javascript Fragment function properly?

Best Regards.

3 REPLIES 3

david.l.morris
Level 15

When you say it didn't work, can you show some examples of what you put?

My first thought is that you may be trying to use Insert JavaScript Fragment like it used to work by itself. In MV3, you have to insert the javascript fragment wrapping your code inside a function and then use invoke javascript function to call that function that you just inserted.

I glanced at the linked document you pointed to, but I don't know that language. You may already be doing what I've just mentioned, but I figured I'd bring it up just in case.


Dave Morris, 3Ci at Southern Company

Hi david.l.morris,

Thank you for your answer.

I'll explain our problem again and attach our example.

We want to insert a custom event on Html page by action: Insert JavaScript Fragment, and invoke the event by action: Invoke JavaScript Function, however, the next error occurred.

''JavaScript invoker returned the following error message: javascript error: createTag is not defined(Session info: chrome=128.0.6613.120)''

We confirmed Html page source and couldn't find our custom event, then we try some event, like alert, log console, but none of it worked. So we think the action: Insert JavaScript Fragment did not work.

Examples: 

 

 

function createTag() {
  var body = document.getElementsByTagName("body")[0];
  var pTag = document.createElement("p");
  pTag.id = "testP";
  pTag.style.display = "none";
  body.insertBefore(pTag, body.firstChild);
}
function logAndAlert() {
  log.console("test");
  alert("test");
}

 

 

Best Regards.

 

@mengjie.he I can't test this at the moment without some effort, so let me just suggest this in case this is the problem. Make sure that if you are not providing input arguments to Invoke JavaScript that you put this into the input: "[{}]". This tells it that you are not providing any input to it. I suppose the error "javascript error: createTag is not defined" may not make much sense for that, but maybe that is the error it gives because it is trying to find a function by that name with a certain signature (same input params but it's not expecting no input params because you didn't provide that null input of "[{}]"). Worth trying anyway. I'll see if I can go test to reproduce that error when I have time within the next few days, and I'll try to remember to come back and post here.


Dave Morris, 3Ci at Southern Company