def check_update_window(self): """ des 点击需求更新窗口的弹窗 :return: """ if isElementExist.by_id_(self.driver, "image_cancel"): self.by_id("image_cancel").click() log.debug('image_cancel元素已定位到') else: log.debug('更新弹窗元素不存在')
def get_hot_result(self): """ des: 获取热门话题文本 :return: """ if isElementExist.by_id_(self.driver, "hot_topic_tv"): res = self.by_id("hot_topic_tv").get_attribute("text") log.debug("get text: " + res) return res else: saveImg.save_img(self.driver, self.currentMethod) log.debug("未找到元素截图")
def stock_page(self): """ des: 点击行情进入自选股票界面 :return: """ if isElementExist.by_id_(self.driver, "image_cancel"): self.by_id("image_cancel").click() log.debug('image_cancel元素已定位到') else: log.debug('更新元素不存在') self.by_xpath("//*[@text='行情']").click() log.debug('进入行情') return StockSelectPage(self.driver)
def hom(self): # BasePage(self.driver).wait(["王炸", "邬炼"]) if isElementExist.by_id_(self.driver, "image_cancel"): self.by_id("image_cancel").click() log.debug('image_cancel元素已定位到') else: log.debug('更新元素不存在') try: a = (By.ID, "tv_search") self.click(a) except Exception as e: log.debug("异常.......................") self.driver.press_keycode(4) print("ddddddddddddddddddddddddddddddddddddddddddddddddddd")
def search(self): """ des: 搜索股票进入股票详情页 :return: """ if isElementExist.by_id_(self.driver, "image_cancel"): self.by_id("image_cancel").click() log.debug('image_cancel元素已定位到并点击去除弹窗') else: log.debug('更新弹窗不存在') # 首页点击搜索框 self.by_id("tv_search").click() log.debug("点击首页搜索框") return SearchPage(self.driver)