Q:

Selenium web driver - login without hard-coding the password in the code

how can I login to an application using Selenium webdriver without hard-coding the password in the code?
Plus I want to hide the 'geckodriver.exe window' during execution.
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.keys import keys
import getpass

driver = webdriver.Firefox()
driver.maxmimize_window()

driver.get("https://example.com")
time.sleep(10)

username=driver.find_element_by_id("txtUserID")
username.clear()
username.send_keys("abc@xyz.com")

.....the rest of the code will continue....

A:

xvfb is a common way of doing this. Searching for "selenium xvfb" should find lots, such as:
How do I run Selenium in Xvfb?
Is it possible to run Selenium scripts without having an X server running, too?
These will help you for headless firefox.

how can I login to an application using Selenium webdriver without
  hard-coding the password in the code?

For this you need to create one GUI or one screen from where user add the password and then you will get that value which was added by user and then use as a password in a specific website.

