Exemple #1
0
 def test_one(self):
     driver = webdriver.Chrome(
         'F:\driver\chromedriver_win32\chromedriver.exe')
     driver.get('http://120.79.59.41/#/login')
     driver.maximize_window()
     time.sleep(2)
     login_zb.login(driver)
     self.assertEqual(driver.title, '金康高科1')
     logout.logout(driver)
Exemple #2
0
 def test_login(self):
     driver = self.driver
     driver.get(self.base_url + '/')
     # 调用登录模块
     login.login(self)
     # 获取用户名
     user = driver.find_element_by_css_selector(
         "#infor > div.head-portrait > a > div").text
     # 用户名是否正确,不正确抛出异常
     if user == u'敏':
         print '登录成功'
     else:
         raise NameError('user name error!')
     time.sleep(3)
     # 退出用例
     logout.logout(self)
     time.sleep(3)
Exemple #3
0
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)

logout.logout(driver)