def test_login(self): #登录成功 time.sleep(10) util = Util() dic = util.read_excel("E:/pythonWorkplace/AppiumTest/data/data.xlsx", "Sheet1") login = LoginPage(self.driver) login.loginfun(dic[0]["name"], dic[0]["password"])
def test_app_zy2(self): u = Util() users = u.read_excel(testdata, sheetname) data = users[0] email = data["username"] pwd = data["userpassword"] data1 = users[1] email1 = data1["username"] pwd1 = data1["userpassword"] print(email, pwd) h = HomePage(self.driver) h.denglu(email, pwd) h.Tuichu() h.denglu(email1, pwd1)
from selenium import webdriver import unittest from ddt import data, ddt, unpack import time from framework.util import Util testdata = Util.read_excel("E:/UI_auto_test/data/data.xlsx", "Sheet1") @ddt class Search_by_ddt(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome("../tools/chromedriver.exe") self.driver.maximize_window() self.driver.get("https://www.baidu.com") self.driver.implicitly_wait(5) @data(*testdata) def test_search_by_ddt(self, data): search_string = data["content"] print("搜索内容->:%s" % search_string) search_input = self.driver.find_element_by_id('kw') # 找到后,键入 java 并提交搜索 search_input.send_keys(search_string) time.sleep(3) search_input.submit() def tearDown(self): """测试结束后的操作,这里基本上都是关闭浏览器""" self.driver.quit()
from selenium import webdriver import unittest from ddt import data, ddt import time from framework.util import Util testdata = Util.read_excel("F:/table.xlsx", "Sheet1") @ddt class Search_by_ddt(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome("../tools/chromedriver.exe") self.driver.maximize_window() self.driver.get("https://www.baidu.com") self.driver.implicitly_wait(5) @data(*testdata) def test_search_by_ddt(self, data): search_string = data["content"] print("搜索内容->:%s" % search_string) search_input = self.driver.find_element_by_id('kw') # 找到后,键入 java 并提交搜索 search_input.send_keys(search_string) time.sleep(3) search_input.submit() def tearDown(self): """测试结束后的操作,这里基本上都是关闭浏览器""" self.driver.quit()
def test_login(self): el = Util.read_excel("E:/workspace/Memorandum/data/info.xlsx", "Sheet1") login = LoginPage(self.driver) login.login(el[0]["user"], el[0]["pwd"])
from selenium import webdriver import unittest from ddt import data, ddt, unpack import time from framework.util import Util testdata = Util.read_excel("H:/python-webUI-auto/data/data.xlsx", "Sheet1") @ddt class Search_by_ddt(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome("../tool/chromedriver.exe") self.driver.maximize_window() self.driver.get("https://www.baidu.com") self.driver.implicitly_wait(5) @data(*testdata) def test_search_by_ddt(self, data): search_string = data["content"] print("搜索内容->:%s" %search_string) search_input = self.driver.find_element_by_id('kw') # 找到后,键入 java 并提交搜索 search_input.send_keys(search_string) time.sleep(3) search_input.submit() def tearDown(self): """测试结束后的操作,这里基本上都是关闭浏览器""" self.driver.quit()
from selenium import webdriver import unittest from ddt import data, ddt, unpack import time from framework.util import Util testdata = Util.read_excel( "C:/Users/Administrator/PycharmProjects/search/excel.xlsx", "Sheet1") @ddt class Search_by_ddt(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome("../tools/chromedriver.exe") self.driver.maximize_window() self.driver.get("https://www.baidu.com") self.driver.implicitly_wait(5) @data(*testdata) def test_search_by_ddt(self, data): # search_string = data[data] d = data search_string = list(d.values()) # search_string = Util().read_excel(testdata) print("搜索内容->:%s" % search_string) search_input = self.driver.find_element_by_id('kw') # # 找到后,键入 java 并提交搜索 search_input.send_keys(search_string) time.sleep(3) search_input.submit()