cancel
Showing results for 
Search instead for 
Did you mean: 

Error when Invoking JavaScript

MartinVM
Level 2

I'm working on version 7.4 of Blue Prism Enterprise, trying to test the Insert/Invoke JavaScript in a navigate action on Chrome. This is on a basic site and I'm only trying to click on a button by using it's xPath, the function and arguments work if used through console, but inserting the function and then inserting a call has no effect, and when I try to use the Invoke JavaScript Function action (after inserting the actual function) I get the following message:

"Internal : Failed to perform step 1 in Navigate Stage 'Invoke Javascript Function' on page 'Insert And Invoke Javascript' - JavaScript invoker returned the following error message: Attempted to Invoke JavaScript without Web Driver"

I've set up everything as per BP and Chrome's documentation:
- Chromedriver version is 138.0.7204.169 and Chrome is 138.0.7204.168.
- Chromedriver's location is on the path environment variable (and can be called through cmd, which I understand proves it's set up correctly).
- Chrome is installed in it's default directory.
- The application is launched with a debug port (9222) and the JavaScript insertions/invocations are done in the same object.
- Task Manager shows "BluePrism.JavaScriptInvoker" process running when launching the browser.

Some other (maybe helpful) info:
- Chrome is read as connected.
- Insertion and invocation are made on the "html[1]/body[1]" element.
- I've attempted this with both Embedded and External (64 bits) modes for the Application Manager, and get the same message regardless.

Any suggestions as to what I might be missing?

2 REPLIES 2

tim.dauti
Level 4

Hello Martin,

I am using xpath with queries in order to click buttons and it works on blue prism 7.3.2 (should be similar to 7.4). Can you show the way you set the xpath?

All the best 

Tim

Edit: Good grief. I just noticed this post was from 1.5 months ago. Definitely worth getting solved and confirm what worked though. Oh well, maybe this information will help someone. 😃

@MartinVM Maybe also try adding in the user-data-dir flag (you could change the path I think but this worked for me):

--user-data-dir="c:\temp\chrome"

so it might look like this:

{your_url} --remote-debugging-port=9222 --user-data-dir="c:\temp\chrome"

I found that this was necessary at least in 7.4.1 which works the same as 7.4, and it was only necessary for Chrome. I think it is basically that there was some security vulnerability involving taking over Chrome through the manipulation of the user's profile or something. Anyway, Chrome was changed so that if you want to use the remote debugging port, then you also have to specify a profile other than the default one. I may be stating this wrong, but it's worth trying it to see if it works for you.

Otherwise, I honestly don't see anything wrong with what you're doing. You nailed every single other step that I've been aware of and genuinely to such perfection that I love the post, and I wish more people could provide the level of detail that you did.

If my suggestion doesn't work, then what I'd ask is if you could show some screenshots next of your configuration of stages and such.

You may also want to try both the insert/invoke way as well as just the straight Invoke way of doing this.

I show both ways at least in MS Edge in this video: https://youtu.be/SfOzlOG0K-A?si=qIYwlMLdLTpU4WKs&t=5195 . I made the link so it should start at 1:26:35 (yes that's 1 hour and 26 minutes in haha). The first part goes over MS Edge, but Edge and Chrome are ALMOST identical in terms of using insert/invoke javascript. The only difference I'm aware of is what I mentioned above, and I show adding that a little after 1:49:04. Here's a link to that point in the video too: https://youtu.be/SfOzlOG0K-A?si=K65lr9ebVwjeexWX&t=6544 .

I found it easier to just do Invoke JavaScript by itself, and that's what I show first in the video at that first link's point (1:26:35). I feel like you already know all of the stuff I show in the video, but it may help you at least validate yourself that you're doing the same thing that works for me in 7.4.1.

Good luck! Insert/Invoke JavaScript is and has always been a beast.

 

 


Dave Morris, 3Ci at Southern Company