0

I am getting Error setting arguments for script error while trying to run browser.exectueAsync in IE 11 .

the code I'm executing is

const result = browser.executeAsync(
   (url, body, done) => {
     fetch(url, {
       method: 'POST',
       credentials: 'same-origin',
       headers: {
         'Content-Type': 'application/json',
       },
       body: JSON.stringify(body),
     })
    .then(resp => resp.json())
    .then(data => done(data));
   },consentsUrl,consentRequestBody);
browser.waitUntil(() => result.value.updated === true);

This works fine on Chrome. so not sure why it would fail on IE11, any ideas.

This is the complete error I get

Failed: Error setting arguments for script (WARNING: The server did 
not provide any stacktrace information)
Command duration or timeout: 66 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 
17:00:58'
System info: host: '***-***-**-***', ip: '***.***.**.***', os.name: 
'windows', os.arch: 'x86', os.version: '10.0', java.version: 
'1.8.0_181'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, 
ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, 
ignoreZoomSetting=false, handlesAlerts=true, version=11, 
platform=WINDOWS, nativeEvents=true,ie.ensureCleanSession=false, 
elementScrollBehavior=0, ie.browserCommandLineSwitches=, 
requireWindowFocus=false, browserName=internet explorer, 
initialBrowserUrl=about:blank, takesScreenshot=true, 
javascriptEnabled=true, ignoreProtectedModeSettings=false, 
enableElementCacheCleanup=true, cssSelectorsEnabled=true, 
unexpectedAlertBehaviour=dismiss}]
Session ID: 0358936f-7358-4899-84dc-57b92133f3c2
Mateen-Hussain
  • 718
  • 1
  • 13
  • 29

1 Answers1

0

I've seen the same behaviour when using browser.execute. In my case this happens when an argument to my function is an object containing keys with hyphens.

I solved this by JSON.stringify(arg) before calling browser.execute(function, arg).

So, my guess is that your consentRequestBody contains keys with hyphens.

I assume this behaviour is caused by org.openqa.selenium.ie.InternetExplorerDriver, but I'm not sure.

RunarB
  • 73
  • 7