executeScript() not working

Hi, I having error message “Error while running .executeScript() protocol action: Method is not implemented” during scroll top to bottom on the iOS real device.

please find code and capabilities below:

// scroll to the bottom of the screen.
app.executeScript(‘window.scrollTo(0,document.body.scrollHeight);’);

app: {
selenium: {
start_process: true,
use_appium: true,
host: ‘localhost’,
port: 4723,
server_path: ‘’,
// args to pass when starting the Appium server
cli_args: [
// automatically download the required chromedriver
// ‘–allow-insecure=chromedriver_autodownload’
],
// Remove below line if using Appium v1
default_path_prefix: ‘’
},
webdriver: {
timeout_options: {
timeout: 150000,
retry_attempts: 1
},
keep_alive: false,
start_process: false
}
},

'app.android.emulator': {
  extends: 'app',
  'desiredCapabilities': {
    // More capabilities can be found at https://github.com/appium/appium-uiautomator2-driver#capabilities
    browserName: null,
    platformName: 'android',
    // javascriptEnabled: true,
    // `appium:options` is not natively supported in Appium v1, but works with Nightwatch.
    // If copying these capabilities elsewhere while using Appium v1, make sure to remove `appium:options`
    // and add `appium:` prefix to each one of its capabilities, e.g. change 'app' to 'appium:app'.
    'appium:options': {
      automationName: 'UiAutomator2',
      // Android Virtual Device to run tests on
      avd: 'nightwatch-android-11',
      // While Appium v1 supports relative paths, it's more safe to use absolute paths instead.
      // Appium v2 does not support relative paths.
      app: `${__dirname}/nightwatch/sample-apps/prod_jlgar.apk`,
      appPackage: 'com.jlg.augmentedreality',
      appActivity: 'crc64247408101294fbd6.SplashActivity',
      // chromedriver executable to use for testing web-views in hybrid apps
      chromedriverExecutable: `${__dirname}/chromedriver-mobile/chromedriver.exe`,
      unlockType: 'pin',
      unlockKey: '123456',
      newCommandTimeout: 0
    }
  }
},

'app.android.real': {
  extends: 'app',
  'desiredCapabilities': {
    // More capabilities can be found at https://github.com/appium/appium-uiautomator2-driver#capabilities
    browserName: null,
    platformName: 'android',
    // javascriptEnabled: true,
    // `appium:options` is not natively supported in Appium v1, but works with Nightwatch.
    // If copying these capabilities elsewhere while using Appium v1, make sure to remove `appium:options`
    // and add `appium:` prefix to each one of its capabilities, e.g. change 'app' to 'appium:app'.
    'appium:options': {
      automationName: 'UiAutomator2',
      // While Appium v1 supports relative paths, it's more safe to use absolute paths instead.
      // Appium v2 does not support relative paths.
      app: `${__dirname}/nightwatch/sample-apps/prod_jlgar.apk`,
      appPackage: 'com.jlg.augmentedreality',
      appActivity: 'crc64247408101294fbd6.SplashActivity',
      // 'chromedriver' binary is required while testing hybrid mobile apps.
      // 
      // Set `chromedriverExecutable` to '' to use binary from `chromedriver` NPM package (if installed).
      // Or, put '--allow-insecure=chromedriver_autodownload' in `cli_args` property of `selenium`
      // config (see 'app' env above) to automatically download the required version of chromedriver
      // (delete `chromedriverExecutable` capability below in that case).
      chromedriverExecutable: '',
      newCommandTimeout: 0,
      // add device id of the device to run tests on, if multiple devices are online
      // Run command: `$ANDROID_HOME/platform-tools/adb devices` to get all connected devices
      // udid: ''
    }
  }
},

'app.ios.simulator': {
  extends: 'app',
  'desiredCapabilities': {
    // More capabilities can be found at https://github.com/appium/appium-xcuitest-driver#capabilities
    browserName: null,
    platformName: 'ios',
    // `appium:options` is not natively supported in Appium v1, but works with Nightwatch.
    // If copying these capabilities elsewhere while using Appium v1, make sure to remove `appium:options`
    // and add `appium:` prefix to each one of its capabilities, e.g. change 'app' to 'appium:app'.
    'appium:options': {
      automationName: 'XCUITest',
      platformVersion: '16.4',
      deviceName: 'iPhone Xʀ',
      // While Appium v1 supports relative paths, it's more safe to use absolute paths instead.
      // Appium v2 does not support relative paths.
      app: `${__dirname}/nightwatch/sample-apps/JLG_ARIAL_X.iOS.app`,
      bundleId: 'com.jlg.augmentedreality',
      newCommandTimeout: 0,
    }
  }
},

'app.ios.real': {
  extends: 'app',
  'desiredCapabilities': {
    // More capabilities can be found at https://github.com/appium/appium-xcuitest-driver#capabilities
    browserName: null,
    platformName: 'ios',
    // `appium:options` is not natively supported in Appium v1, but works with Nightwatch.
    // If copying these capabilities elsewhere while using Appium v1, make sure to remove `appium:options`
    // and add `appium:` prefix to each one of its capabilities, e.g. change 'app' to 'appium:app'.
    'appium:options': {
      automationName: 'XCUITest',
      // While Appium v1 supports relative paths, it's more safe to use absolute paths instead.
      // Appium v2 does not support relative paths.
      app: `${__dirname}/nightwatch/sample-apps/JLG_ARIAL_X.ipa`,
      bundleId: 'com.jlg.augmentedreality',
      newCommandTimeout: 0,
      // add udid of the device to run tests on. Or, pass the id to `--deviceId` flag when running tests.
      // device id could be retrieved from Xcode > Window > "Devices and Simulators" window.
      udid: 'd330b6719543ae09194e5516b7b6ff48d99b8787',
        xcodeOrgId: 'Apple Development: Yashwant Rathore (C669RPUFH7)',
      xcodeSigningId: '34D4QF33TF'
    }
  }
},

}

with Appium 2.x you need also install

  appium plugin install execute-driver