import ddt from func1.csvreader import reader from test_case1.BaseTest import BaseTest from selenium.webdriver.support.wait import WebDriverWait @ddt.ddt class edit_test(BaseTest): table=reader(r"addnote1.csv") @ddt.data(*table) def test_case(self,row): self.driver.implicitly_wait(10) aa=WebDriverWait(self.driver,15).until(lambda x: x.find_element_by_id("com.youdao.note:id/btn_ok")) if aa: # 点击同意按钮 self.driver.find_element_by_id("com.youdao.note:id/btn_ok").click() # 点击取消按钮 self.driver.find_element_by_id("com.youdao.note:id/btn_cancel").click() # 点击新增按钮 self.driver.find_element_by_id("com.youdao.note:id/add_note").click() # 点击新建笔记 self.driver.find_element_by_id("com.youdao.note:id/add_icon").click() # 点击“ALLOW"按钮 self.driver.find_element_by_id("com.android.packageinstaller:id/permission_allow_button").click() # 输入内容 self.driver.find_element_by_xpath( "//*[@resource-id='com.youdao.note:id/note_content']/android.widget.EditText").send_keys(row[1]) # 输入标题 self.driver.find_element_by_id("com.youdao.note:id/note_title").send_keys(row[0]) # 点击"完成"按钮 self.driver.find_element_by_id("com.youdao.note:id/actionbar_complete_text").click() # 获取新增成功后的标题内容 result = self.driver.find_element_by_id("com.youdao.note:id/title").text # 断言判断 self.assertEqual(row[0],result) # 点击搜索按钮 self.driver.find_element_by_id('com.youdao.note:id/search').click() # 输入搜索关键字 self.driver.find_element_by_id('com.youdao.note:id/search_edit_view').send_keys(row[0]) # 点击搜索按钮 self.driver.find_element_by_id('com.youdao.note:id/action_btn').click() # 获取搜索后的标题内容 result=self.driver.find_element_by_id("com.youdao.note:id/title").text # 断言判断 self.assertEqual(row[0],result) # 选择要修改的笔记 self.driver.find_element_by_id('com.youdao.note:id/title').click() #点击修改 self.driver.find_element_by_id("com.youdao.note:id/edit").click() #修改内容 self.driver.find_element_by_xpath( "//*[@resource-id='com.youdao.note:id/note_content']/android.widget.EditText").send_keys(row[3]) #修改标题 self.driver.find_element_by_id("com.youdao.note:id/note_title").send_keys(row[2]) # 点击完成 self.driver.find_element_by_id("com.youdao.note:id/actionbar_complete_text").click() #获取修改后的标题 result=self.driver.find_element_by_id('com.youdao.note:id/note_title').text #断言 self.assertEqual(row[2],result)
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/addevelopment/892920.html