I am doing some test automation. I create a scratch org and a user with a generated password. However, I am running a test script which opens up its own browser. I fill in the username and generated password but is always ask for the verification code. I would like the the test user to log in without verification. As this an automation and spins off a scratch org everytime, we cannot manually set the trusted IP range. So is there a way to do this in a settings file? or is there other ways to do what I'm trying to do? Seems this is very typical scenario for test automation.

  • Can't you just sfdx force:org:open -u <username> in your script?
    – sfdcfox
    Commented Feb 14, 2018 at 3:21
  • No, because the test script uses selenium to open the browser
    – rrey
    Commented Feb 14, 2018 at 4:46

1 Answer 1


I believe the correct metadata type for this is SecuritySettings https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_securitysettings.htm - if DX can successfully push this to the scratch org before your test script opens the browser, it should bypass the verification code.

Searching seems to suggest DX supports this non-packageable metadata type.

  • That's exactly what I was going to say. You could even force:mdapi:deploy if you had to.
    – sfdcfox
    Commented Feb 14, 2018 at 3:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .