Multi-factor authentication - Selenium automation



  • My company uses Multi-factor authentication to restrict access to some sites. Is it possible to copy user profile from firefox and use it in my new window?



  • Yes you can achieve this using profile:

    Just login to the system and save the login session,

    you can get profile folder by typing chrome://version in tab:

    enter image description here

    1. Open path\Google\chrome folder

    2. goto user data folder

    3. Copy the path to Default folder

    Now set it in chromeoptions:

    chromeOptions:{'args': ['--user-data-dir=%yourpath%\\Local\\Google\\Chrome\\User Data']}
    

    Note : this code is for protractor , you can use the python equivalent

    make sure that there is no space after '=' sign and now quotes eg don't use '--user-data-dir="%yourpath%\\Local\\Google\\Chrome\\User Data"'

    Also make sure all chrome sections are closed

    If you are copying th profile to another folder say testprofile, keep the folder name as default so you just need to use

    chromeOptions:{'args': ['--user-data-dir=%yourpath%\\testprofile']}
    

    if the profile folder is not as testprofile\Default the you have to pass it as

    --profile-directory=<thenewfoldername>
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2