I have this config.ini
file:
[login]
username = test123
my config reader file config_read.py
:
from configparser import ConfigParser
def config_reader():
config = ConfigParser()
config.read('config.ini')
username = config['login']['username']
return username
How can I then use the username
in my test case to type it in Username input field?
With selenium, what you need is send keys.
driver = webdriver.Chrome
driver.get("Your link")
driver.find_element_by_(Xpath, Id or CSS selector of your login field).send_keys("Your username")
With this, you will get your username and password possibly to your login field
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.