Search code examples
javascriptartificial-intelligenceblueprismrpa

Blue Prism - Hot to use Invoke Javascript function


I have a issue with understanding how in BP Invoke Javascript works? On online SAP system i need to enter a login and password in to 2 textboxes on page. When I run my code in the Firefox console

document.getElementsByName('sap-user')[0].value = 'test';

the textbox on page is filled with test and is working.

When I try to do the same in Blue Prism nothing happens. I have created a variable which is holding the script:

<script>
function test(){
document.getElementsByName('sap-user')[0].value = 'test';
return;}
</script>

and running the code in the Navigate stage.

enter image description here

In the arguments I m passing the variable [jScript] name which is holding the script.

Element3 is the textbox spy element on page.

Dont know how to run the script in Blue Prism?

I'm to new in the javascript maybe my code is wrong?

Thank you for any help, Mirek


Solution

  • The details in this answer should help; summary is that you call Insert to add the JS to the page and then Invoke to fire the method. The Arguments you send to the Invoke are in JSON format, e.g. "[{}]" even if the method requires no arguments.

    Unable to Invoke Inserted Javascript Fragment