请老师查收:
https://github.com/yuwenli/hogwarts_yuwenli/tree/master/hogwarts_practices/seleniumPOPractices
- 谢谢 xixi 老师,采取老师的建议,已修改
https://github.com/guoccf927/HogwartsLG6Gcc/tree/master/homework_05/live - 看到新的idea 一定要试一下
-
def check_user_info_last(self, check_info_list, info_list=[]): """ 第六阶段12节 数据驱动 所感 :return: 默认参数 False ,找到 check_info_list 即更新参数为 True """ # 设置默认参数 exist_flag = False # 获取当前页用户信息 ele_list = self.finds(By.CSS_SELECTOR, ".member_colRight_memberTable_td") for ele in ele_list: info_list.append(ele.get_attribute("title")) print(f"全部用户信息为:{info_list}") # 存在,则更新参数为 True if check_info_list[0] in info_list and check_info_list[1] in info_list: exist_flag = True return exist_flag try: """ 1、点击下一页 2、打印当前页数 3、循环 """ self.click(By.CSS_SELECTOR, ".js_next_page") page_str = self.find(By.CSS_SELECTOR, ".ww_pageNav_info_text").text print(f"当前页数:{page_str}") return self.check_user_info_last(check_info_list, info_list) except NoSuchElementException as e: print("except:", e)
https://github.com/Abigail2020/python/tree/master/webAutomation/seleniumPO
老师好,我把seleniumPO思想用在了公司项目里,我的疑问有
1.如何把显示等待运用到basepage里,这个是我根据dong封装的find方法,用于定位
def find(self, by, locator=None):
element = self.driver.find_elements(*by) if isinstance(by, tuple) else self.driver.find_element(by, locator)
2.这个项目是一个聊天室,分为agent和client端,要断言的页面就是进入chatting-room,对chatting-room里的checklist/take photo按钮/submit/cancel等按钮功能和页面内容做断言;
疑问是:一个页面有很多断言,是不是把断言封装成一个 common assert类比较合适
3.老师帮忙看下,还有什么需要改进的,辛苦老师!!!