Work, often to create accounts for multiple users, in order to reduce the workload, wrote an automated script to help me batch create users
The code is as follows:
"""Automatic creation of Jira student accounts""" fromSeleniumImportWebdriver fromTimeImportSleepImportCsvdriver= Webdriver. Chrome (R'D:\selenium\tools\chromedriver.exe') Driver.get ("http://xxx:8090/login.jsp")#Jira's websiteData_set = R'C:\Users\xxx\Desktop\data.csv'Sleep (10)#Enter user name and passwordDRIVER.FIND_ELEMENT_BY_ID ('Login-form-username'). Send_keys ('Songqin') driver.find_element_by_id ('Login-form-password'). Send_keys ('Woaisongqin') driver.find_element_by_id ('Login-form-submit'). Click () Sleep (5) driver.find_element_by_id ('Admin_menu'). Click () driver.find_element_by_id ('Admin_users_menu'). Click () driver.find_element_by_id ('Login-form-authenticatepassword'). Send_keys ('Woaisongqin') driver.find_element_by_id ('Login-form-submit'). Click () driver.implicitly_wait (15)#Create user#driver.find_element_by_id (' Create_user '). Click ()#Create user PanelReader = Csv.reader (open (data_set,encoding='Utf-8')) Rows= [row forRowinchReader]Print(rows) forIinchrows:driver.implicitly_wait (15) driver.find_element_by_id ('Create_user'). Click () driver.find_element_by_id ('User-create-username'). Send_keys (I[0]) driver.find_element_by_id ('User-create-password'). Send_keys (i[1]) driver.find_element_by_id ('user-create-confirm'). Send_keys (i[2]) driver.find_element_by_id ('User-create-fullname'). Send_keys (i[3]) driver.find_element_by_id ('User-create-email'). Send_keys (i[4]) driver.find_element_by_id ('User-create-submit'). Click () Sleep (2) Driver.back () driver.close ()
Data.csv Table Contents:
Show Results:
python3.5 Jira Web site for user BULK Insert