class Test_(object): def setup_class(self): self.driver=Initdriver() self.page=Page(self.driver).page_改变处() print("开始了!!!") def teardown_class(self): time.sleep(6) self.driver.quit() print("结束了")
class Test_address(object): def setup_class(self): self.driver = Initdriver() self.page = Page(self.driver).page_address() print("开始了!!!") def teardown_class(self): time.sleep(6) self.driver.quit() print("结束了!!!") @pytest.fixture(scope="function") def start_address(self): self.page.click_address() @pytest.fixture(scope="class") def click_bdbc(self): self.page.click_bdbc() @pytest.mark.parametrize("expect", ["新增联系人"]) def test_001(self, expect): self.page.click_address() self.page.click_bdbc() time.sleep(1) text_list = self.driver.page_source assert expect in text_list @pytest.mark.parametrize("expect", ["所有联系人"]) def test_002(self, expect): self.page.out_address() time.sleep(1) text_list = self.driver.page_source assert expect in text_list @pytest.mark.usefixtures("start_address") @pytest.mark.parametrize("test_no,name,phone,expect", read_test_data()) @allure.step(title="添加联系人测试") def test_003(self, test_no, name, phone, expect): print(test_no, name, phone, expect) self.page.send_message(name, phone) self.page.out_address() time.sleep(5) if name == "" and phone == "": pass else: self.page.out_keyevent() time.sleep(0.1) text_list = self.driver.page_source assert expect in text_list, self.page.save_screen()
class Test_(object): def setup_class(self): self.driver = Initdriver() self.page = Page(self.driver).page_delmsm() print("开始了!!!") def teardown_class(self): time.sleep(6) self.driver.quit() print("结束了") # @pytest.fixture(scope="class") # def start_search(self): # self.page.click_search() # # @pytest.mark.usefixtures("start_search") # @pytest.mark.parametrize("text",["f**k","f**k you","shit"]) def test_001(self): self.page.delete_msm()
class Test_search(object): def setup_class(self): self.driver = Initdriver() self.page = Page(self.driver).page_search() print("开始了!!!") def teardown_class(self): self.page.out_search() time.sleep(6) self.driver.quit() print("结束了") @pytest.fixture(scope="class") def start_search(self): self.page.click_search() @pytest.mark.usefixtures("start_search") @pytest.mark.parametrize("test_no,text,expect", read_test_data()) def test_001(self, test_no, text, expect): self.page.input_search(text) self.driver.get_screenshot_as_file('../picture/%s.png' % test_no) time.sleep(1) text_ml = self.driver.page_source assert expect in text_ml
def setup_class(self): self.driver = Initdriver() self.page = Page(self.driver).page_search() print("开始了!!!")
from base.init_driver import Initdriver from appium import webdriver driver = Initdriver() elm1 = driver.find_element_by_xpath("//*[contains(@text,'119')]/..") elm2 = driver.find_element_by_xpath("//*[contains(@text,'#')]") elm3 = driver.find_element_by_xpath("//*[contains(@text,'傻逼')]") print(elm1.location) # y1=elm1.location.get('y') # print(elm2.location) # y2=elm2.location.get('y') # print(elm3.location) # y3=elm3.location.get('y') # print(type(y1)) # print(y1) # print(y2) # if y2 < y3 <y1: # print(True) # # # # # # # num1=10 # num2=20 # if num1 < num2: # print(True)