多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 添加用户代码 ~~~ from selenium import webdriver from time import sleep d = webdriver.Chrome() d.get('http://os-201804081018/blog/wp-login.php') d.maximize_window() sleep(3) # 登录系统 d.find_element_by_css_selector('#user_login').send_keys('test') sleep(3) d.find_element_by_css_selector('input[type="password"]').send_keys('test123') sleep(3) d.find_element_by_css_selector('p.submit input#wp-submit').click() sleep(3) # 点击用户 d.find_element_by_css_selector('#menu-users .wp-menu-name').click() sleep(1) # 点击添加用户 d.find_element_by_css_selector('.page-title-action').click() sleep(1) # 输入用户名 d.find_element_by_css_selector('#user_login').send_keys('test123') sleep(1) # 输入电子邮件 d.find_element_by_css_selector('#email').send_keys('test123@qq.com') sleep(1) # 点击显示密码 d.find_element_by_css_selector('.wp-generate-pw').click() sleep(1) # 清空原来密码 d.find_element_by_css_selector('#pass1-text').clear() sleep(1) # 输入新密码 d.find_element_by_css_selector('#pass1-text').send_keys('123456') sleep(1) # 确定使用弱密码 d.find_element_by_css_selector('.pw-checkbox').click() sleep(1) # 点击下拉框 d.find_element_by_css_selector('#role').click() sleep(1) # 点击角色 d.find_element_by_css_selector('[value="editor"]').click() sleep(1) # 点击添加用户 d.find_element_by_css_selector('#createusersub').click() sleep(1) d.close() d.quit() ~~~