Ejemplo n.º 1
0
 def get_recommended_down_res(self):
     """
     des: 定位"推荐"文本并返回
     :return:
     """
     if isElementExist.by_xpath_(self.driver, "//android.widget.TextView[@text='推荐']"):
         res = self.by_xpath("//android.widget.TextView[@text='推荐']").text
         return res
     else:
         saveImg.save_img(self.driver, self.currentMethod)
         log.debug("未找到元素截图")
Ejemplo n.º 2
0
 def get_price(self):
     """
     des: 获取ibm股票价格
     :return:
     """
     try:
         res = self.by_id("stock_current_price").text
         log.debug("获取股票价格")
         return res
     except NoSuchElementException as e:
         log.debug("未找到元素")
         saveImg.save_img(self.driver, self.currentMethod)
Ejemplo n.º 3
0
 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("未找到元素截图")
Ejemplo n.º 4
0
 def search_stock(self, key_words):
     """
     des: 搜索ibm股票进入股票详情页
     :return:
     """
     try:
         self.by_id("search_input_text").send_keys(key_words)
         log.debug("搜索关键字%s" % key_words)
         # 选择第一个
         self.by_id("name").click()
         log.debug("点击第一个候选结果")
         # 进入股票详情页
         self.by_id("stock_layout").click()
         log.debug("进入股票详情")
     except NoSuchElementException as e:
         log.debug("未找到元素", e)
         saveImg.save_img(self.driver, self.currentMethod)
     return self
Ejemplo n.º 5
0
 def get_stock_name(self):
     try:
         return [e.text for e in self.driver.find_elements(By.ID, 'portfolio_stockName')]
     except Exception as e:
         print(e)
         saveImg.save_img(self.driver, self.currentMethod)