-2

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

Mirosław Gądek
  • 118
  • 2
  • 10
  • Can you share a screenshot of *how* you're accomplishing this in your Navigate stage? There are usually two options for JavaScript interactions: `Insert JavaScript Fragment` and `Invoke JavaScript` (or something to that effect); both work very differently from each other. In any case `` is HTML, and not valid JavaScript. It's likely this is contributing to the fact that the script isn't performing as you had intended. – esqew Jun 01 '20 at 14:21
  • Hi I have updated my post. – Mirosław Gądek Jun 02 '20 at 06:54

1 Answers1

0

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

Mark Wood
  • 41
  • 1