class Test_mobile_display(): def setup(self): self.driver = init_driver() self.display_page = PageDisplay(self.driver) def test_mobile_display_input(self): # self.driver.find_element_by_xpath("//*[contains(@text,'显示')]").click() # self.driver.find_element_by_id("com.android.settings:id/search").click() # self.driver.find_element_by_id("android:id/search_src_text").send_keys("hello") # self.driver.find_element_by_class_name("android.widget.ImageButton").click() self.display_page.click_display() self.display_page.click_search() self.display_page.input_text("hello") self.display_page.click_back()
class TestDisplay: def setup(self): self.driver = init_driver() self.page_display = PageDisplay(self.driver) #页面类PageDisplay的类对象 def teardown(self): self.driver.quit() def test_mobile_display_input(self): #步骤1:点击“显示”按钮 self.page_display.click_display() #步骤2:点击“放大镜”按钮 self.page_display.click_fandajin() #步骤3:在“搜索文本框”中输入"hello" self.page_display.input_search_text("hello") #步骤4:点击“返回箭头”按钮 self.page_display.click_back()