I'm working a project to automate logging into a couple of sites and creating users in those sites. It seems to me Selenium is skipping lines and not waiting for user input in the console. I have notated the areas where it skips with python comment marks. I have also replaced specific information with generalized information. Is there something I need to do to force Selenium to wait on console input or is it a bug? Any advice would be appreciated. Also, I'm relatively new to Python as a whole and any bad practices you see please let me know. Below is my code so far.
Note: Little backstory. I started on website2 first and ran into a few issues I'm still working through so I moved to website1 and the code is incomplete as I'm building code as I progress through the layers of the site.
def website1Login():
driver.get('website1.com')
username = input("Please enter your username: ") # Waits for action
searchBox = driver.find_element_by_name('username')
searchBox.send_keys(username)
password = input("Please enter your password: ") # skips action
searchBox = driver.find_element_by_name('password')
searchBox.send_keys(password)
searchBox.submit()
def website1Create():
webOrExchange = 0
webOrExchange = input("Select a service: \n" # Skips action
"1. Webmail\n"
"2. Exchange\n\n"
"Service Selected: ")
time.sleep(10)
if webOrExchange == 1:
webmailSelect = driver.find_element_by_partial_link_text('EmailHosting/Mail/Mailboxes/List.aspx')
webmailSelect.click()
time.sleep(2)
else:
exchangeSelect = driver.find_element_by_partial_link_text('Exchange/Mail/Mailboxes/List.aspx')
exchangeSelect.click()
time.sleep(2)
def website2login():
driver.get('website2.com')
username = input("Please enter your username: ") # Waits for this action
searchBox = driver.find_element_by_id('USER')
searchBox.send_keys(username)
password = input("Please enter your password: ") # Skips this action
searchBox = driver.find_element_by_id('PASSWORD')
searchBox.send_keys(password)
searchBox.submit()
def website2Create():
idmSelect = driver.find_element_by_id('Identity Management') # Selects Identity Management app
idmSelect.click()
time.sleep(15)
createNewUser_Select = WebDriverWait(driver, 15).until(
EC.visibility_of_element_located((By.XPATH, '//*[@id="request_category2"]/ul/li')) # Selects Create New User
)
createNewUser_Select.click()
time.sleep(10)
driver.quit()
def main():
website1Login()
website1Create()
# website2login()
# website2Create()
main()