If it is a PopUp window from a browser, it probably can't be interacted with using JavaScript.
If it's something like a "Save As" window, it may be possible to spy is using Win32 mode. The PopUp window may also be in a separate Windows process, meaning that you may need to create a new Business Object and Attach to it separately from the main Business Object. Blue Prism has a Support Centre article that outlines the approach in more detail:
http://portal.blueprism.com/customer-support/support-center#/path/1161378212But to answer your question, in order to trigger JavaScript, you need to have spied an element using the Browser spy mode. You can insert JS functions and invoke those JS functions from within a Navigate stage. So you could wrap your "button click" into a JS function, Insert it and then Invoke it.
http://portal.blueprism.com/customer-support/support-center#/path/1140187692------------------------------
James Man
Professional Services
Blue Prism
Asia/Hong_Kong
------------------------------