Search code examples
appiumappium-ios

Set autoAcceptAlerts on start appium in terminal.


Is there a way to launch Appium via terminal with autoAcceptsAlerts set on true?

This is my script which I start Appium:

start_appium(){
  source ~/.bash_profile
  $NODE $APPIUM_JS 
  --app $APPLICATION_PATH
  --address "0.0.0.0" 
  --port $1 
  --udid myudid
}

I want to add autoAcceptAlerts. Is it possible?


Solution

  • Appium 1.5 does away with most CLI flags; the remainder can be converted into JSON and made part of the --default-capabilities flag. For example:

    # raw JSON as an argument
    --default-capabilities '{"app": "myapp.app", "deviceName": "iPhone Simulator"}'
    # or the name of a JSON file
    --default-capabilities /path/to/file.json
    

    So to set autoAcceptAlerts on terminal, you would run:

    $ appium --default-capabilities '{"autoAcceptAlerts": true}'
    

    Source: http://appium.io/slate/en/master/?java#the-default-capabilities-flag