Run JavaScript Already in the Page

I’ve been trying to get the JS in the page to run using puppeteer and it doesn’t seem to be working. I have the chrome driver doing the rest of the actions in the screenshot (reaching out to the page, updating the input field, and submitting the form) but I cannot get the JS in the target page (which is in the head of the DOM) to load. I need that JS to run since there is a hidden field that needs to be updated in the form.

Any ideas of how I should be going about this?

There is a funciton x that will get run when a script is loaded from a cdn. I haven’t been able to get that onload to trigger with puppeteer but it works fine when I navigate there myself in Chrome/Firefox manually.

Maybe change the page load event in the “navigate to” block to network idle, so you know all scripts have been downloaded and the function is available. Or add a manual delay.

1 Like

That worked! For future folks, you use the drop down and chose a “networkidle” option.

1 Like