Search code examples
jsonsafariintern

Unable to set Safari WebDriver options in intern config file


By default Safari WebDriver uses the /Users/[username]/Library/Safari location as the data directory location. This location can be overridden per 'dataDir' option on Safari WebDriver (please see this link)

I have tried the following ways to set this property in Intern configuration and none has been successful:

environments:[
{ browserName: 'safari', version: 'ANY', platform: 'MAC',
  dataDir:'/Users/[username]/Library/Safari'
//or
  'safari.options.dataDir':'/Users/[username]/Library/Safari'
//or
  'safari-option-dataDir':'/Users/[username]/Library/Safari'
  }
]

Please advise as to how this and other WebDriver capabilities can be set through the Intern config file in this JSON format.


Solution

  • The instructions for this driver, on the configuration page you linked, are very confusing. What they are saying is that you need to put the sub-options for the driver in an object on the safari.options key, like so:

    environments: [ {
      browserName: 'safari',
      version: 'ANY',
      platform: 'MAC',
      'safari.options': { dataDir: '/Users/[username]/Library/Safari' }
    } ]