c# - What are some techniques or Frameworks to secure username and password credentials in Selenium Web Automation Testing? -


i'm using selenium web driver web page automation. website on want run test automation has authentication page need enter username , password. have used sendkeys() enter both username , password.writing such credentials plain texts in source code not practice
are there programming libraries send encrypted texts through automation rather username , password strings?

no when sending username , password login form in selenium must not encrypted has same manually.

however if dont want keep username , password plain strings can put in app.config file.but let see credentials has access binaries.

but if want credentials more secure can use below options

option 1

when ever start selenium web driver test ask username , password entered argument c# console application. dont have store username , password anywhere

ex: myseleniumtest.exe 'username' 'password'

  1. create xml or json file or event text file in solution , store username , password
  2. right click file , change build action property embedded resource [ note: make file embedded in exe. if 1 has access binaries wont able find credentials]
  3. access content of file in run time using below code.

sample code

var assembly = assembly.getexecutingassembly();             const string resourcename = "mycompany.myproduct.myfile.txt";             using (var stream = assembly.getmanifestresourcestream(resourcename))             {                 if (stream != null)                     using (var reader = new streamreader(stream))                     {                         var result = reader.readtoend();                         // find username , password                     }             } 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -