Inject JS Script (JavaScript) behaves differently in Internet Explorer and Chrome

Scenario:

I am trying to inject same JavaScript to both Internet Explorer and Chrome. Script is a simple one that returns number value 1. See the script below.

function return1(){
    return 1;
}

Same activity works fine with IE and results in an error when tried with chrome. See the details below.

Steps to reproduce:

  • Start a new process.
  • Create a variable jsReturnValueFromIE of type Int32.
  • Create a variable jsReturnValueFromChrome of type Int32.
  • Add open browser activity and choose IE as browser type.
  • Add Insert JS Script Activity and set the script provided in the scenario section.
  • Set ScriptOutPut to jsReturnValueFromIE.
  • Add open browser activity and choose Chrome as browser type.
  • Add Insert JS Script Activity and set the script provided in the scenario section.
  • Set ScriptOutPut to jsReturnValueFromChrome.

Current Behavior:

Insert JS Script Activity with IE returns the integer value 1 and stores in jsReturnValueFromIE.
Insert JS Script Activity with Chrome results in an error - Message: is not a valid value for Int32.

According to official documentation, output of Insert JS Script, ScriptOutPut returns a string.

ScriptOutput - String result returned from JavaScript code.

Expected Behavior:

For both IE and Chrome values should get saved in the respective variables of type Int32.

Comments:

I have tried this with Chrome and IE only. Not sure whether this issue exist in other browsers too.

Studio/Robot/Orchestrator Version:

Studio Version: 2019.4.2
OS Version: Windows 10
Chrome Version: 74.0.3729.131 (Official Build) (64-bit)
IE Version: 11.706.17134.0

Attachments

Sample Process

InsertJSSampleProcess.zip (12.1 KB)

Error Message

Runtime%20Error%20Inject%20Js%20Script

Error Details
19.4.2+Branch.master.Sha.e17a3bedca2a7da0d0b716b5f8f765d1d5ef1ddc

Source: Inject Js Script 'Body Chrome'

Message:  is not a valid value for Int32.

Exception Type: System.Exception

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Exception:  is not a valid value for Int32. ----> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   --- End of inner ExceptionDetail stack trace ---
   at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
   at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
   at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
1 Like

Hi @KannanSuresh

Thank you for reporting, I’ve added it to our internal bug tracker.
I’ve also tested it with the beta UiAutomation pacakge and it continues to give such result.

1 Like

Thank you @loginerror. Continue your awesome work.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.