from selenium import webdriver from public import login from public import logout import time from excel import data driver = webdriver.Chrome('F:\driver\chromedriver_win32_0625\chromedriver.exe') login.open(driver, '金康高科', 'guest', '789996') #点击组织管理 time.sleep(1) driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div/ul/li[2]/a").click() #点击运营中心管理 time.sleep(1) driver.find_element_by_xpath("//*[@id='menu_left']/ul/li[1]/a").click() time.sleep(3) #点击新建运营中心按钮 driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[1]/a/span[2]").click() time.sleep(1) #输入运营中心的名称 driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/form/div[1]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_yyzx.xls')[0]) driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/form/div[2]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_yyzx.xls')[1]) driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[2]/div/button[1]/span").click() time.sleep(3) #输入密码和确认密码 driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/div[2]/form/div[5]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_yyzx.xls')[2]) driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/div[2]/form/div[6]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_yyzx.xls')[3]) driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/div[2]/form/div[7]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_yyzx.xls')[4]) #点击保存按钮 driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[2]/div/button/span").click() time.sleep(2)
def test_login_unusual(self): login.open(driver, '金康高科', 'guest', '123456') self.assertEqual( driver.find_element_by_xpath('/html/body/div[2]/p').text, '公司名、用户名或密码错误', msg='提示信息不对')
from selenium import webdriver from public import login from public import logout import time from excel import data driver = webdriver.Chrome('F:\driver\chromedriver_win32_0625\chromedriver.exe') login.open(driver, '利楚', 'admin', '123456') time.sleep(2) driver.find_element_by_xpath( '//*[@id="app"]/div/div[3]/div/ul/li[2]/a').click() time.sleep(1) driver.find_element_by_xpath('//*[@id="menu_left"]/ul/li[3]/a').click() time.sleep(1) driver.find_element_by_xpath( '//*[@id="app"]/div/div[4]/div/div[2]/div/div[1]/div[2]/div[2]/div[1]/button/span' ).click() time.sleep(2) driver.find_element_by_xpath( '//*[@id="companyinfos_box"]/div[1]/form/div[1]/div/div/div/input').click( ) time.sleep(1) driver.find_element_by_xpath( '/html/body/div[2]/div[1]/div[1]/ul/li[1]/span').click() #输入门店名称 driver.find_element_by_xpath( '//*[@id="companyinfos_box"]/div[1]/form/div[2]/div/div[1]/input' ).send_keys( data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_md1.xls') [0])
from selenium import webdriver from public import login from public import logout import time from excel import data driver = webdriver.Chrome('F:\driver\chromedriver_win32_0625\chromedriver.exe') login.open(driver, '金康高科华中区', 'admin', '123456') #点击组织管理 time.sleep(2) driver.find_element_by_xpath("//*[@id='app']/div/div[3]/div/ul/li[2]/a").click() time.sleep(3) #点击服务商管理菜单 driver.find_element_by_xpath("//*[@id='menu_left']/ul/li[1]/a").click() time.sleep(2) #点击新建服务商按钮 driver.find_element_by_xpath("//*[@id='app']/div/div[4]/div/div[2]/div/div[1]/div[3]/div[1]/div[2]/div[1]/button/span").click() time.sleep(3) #输入服务商的基本信息 #输入服务商全称 driver.find_element_by_xpath("//*[@id='companyinfos_box']/div[1]/form/div[1]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_fws.xls')[0]) #输入服务商简称 driver.find_element_by_xpath("//*[@id='companyinfos_box']/div[1]/form/div[2]/div/div[1]/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_fws.xls')[1]) #输入所属收银系统 driver.find_element_by_xpath("//*[@id='companyinfos_box']/div[1]/form/div[3]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_fws.xls')[2]) #填写负责人 driver.find_element_by_xpath("//*[@id='companyinfos_box']/div[1]/form/div[4]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_fws.xls')[3]) #填写手机号 driver.find_element_by_xpath("//*[@id='companyinfos_box']/div[1]/form/div[5]/div/div/input").send_keys(data.read_excela(r'D:\Python project\yunyingpingtai\excel\test_fws.xls')[4]) #找到省份输入框的位置