Support > Forums > OpenBots Studio > Browser Inject JS command

Browser Inject JS command

sagarika patil

  • Reporter
  • Calender Icon March 11,2022 at 8:02 AM

Hey,

How I can use Native Browser Inject JS command? How I can use JavaScript variable outside the script?

Thanks

This forum has 317 topics, 687 replies, and was last updated 4 months ago by Nataly Alvarado...

Poornima Malviya

  • Participant
  • Calender Icon March 14,2022 at 8:21 AM

Hi SGAPAT001,

Sorry for the late response. After several tests, the feature you requested is not available yet. But we are glad for sharing such viable suggestion and we would include in the next version of the tool.

Thankyou.

sagarika patil

  • Participant
  • Calender Icon March 11,2022 at 10:08 AM

I am assigning value in JavaScript, but I am not able to get that value outside the script. It is showing "NULL" in message Box.

Poornima Malviya

  • Participant
  • Calender Icon March 11,2022 at 9:58 AM

Hi SGAPAT001,

To work with the Native Browser inject JS command, you need to first launch the application using Native Browser Create application.

  1. Native Browser Create Application command - Parameter a) Create a variable of OBApp Instance type b) Select engine type - Chrome/Edge/Firefox c) URL
  2. Native Browser Inject JS command - The JS will be executed on the active window, so the parameters a) OB App Instance variable create in the above step b) Script Source - Script Code/ File path As per your requirement as you need the variable outside the script. Please select the Script code as Script Source. c) Script Code - Enter the java script, to add variable inside the script. First in the variable tab, create a variable of datatype you wish and then inside the script code region, assign it. Later you can use show message command to display that particular variable output.

Please let me know in case of further queries.

You are not authorized to reply, please click here to login and add your reply to this topic.