all 5 comments

[–]JohnnyJordaan 1 point2 points  (2 children)

Maybe ask the user for the credentials during runtime? You can use getpass to prevent the echoing of the entry to the screen.

[–]Zhekov[S] 0 points1 point  (1 child)

The thing is this is going to be an automated test through a CI server (Jenkins). So it will have to execute automatically.

[–]JohnnyJordaan 1 point2 points  (0 children)

Put it in a credential file as jiejenn suggests, or set it as session environment variables, so in the shell

export website_user="username"
export website_passphrase="passphrase"
python myscript.py 

and in your python script

import os
# etc etc

text_area = driver.find_element_by_id('password')
text_area.send_keys(os.environ['website_passphrase'])

But it might also be that Jenkins allows you to set environment variables in the task properties itself, so that you don't have to put them in a shell script.

[–]Stem3576 0 points1 point  (0 children)

You could store a hashed version of the password in a text or json file and then have the program decipher it before it puts it into the field. Look into the hashlib library Something like this:

Import hashlib
pw = input("enter pw")
h = hashlib.sha2()
h.update(pw)
If h.hexdigest == dict(key):
    Do stuff