Exemple #1
0
    def is_logined(self, action: ElementActions):
        #已登陆时返回True

        if action.find_ele(self.注册登陆, wait=2) != None:
            return False
        else:
            return True
Exemple #2
0
 def pageinto(self, action: ElementActions):
     action.sleep(0.5).start_activity(self.activity)
     usercenterpage = UserCenterPage()
     # usercenterpage.pageinto(action)
     if action.find_ele(usercenterpage.注册登陆) != None:
         action.click(usercenterpage.注册登陆)
     else:
         log.info('app已是登陆状态,无法进入登陆页')
def browseproduct(action: ElementActions, key='专场', position=0):
    p.搜索后列表页.pageinto(action, key)
    # 点击对应position的商品
    action.sleep(1).click_ele(
        action.find_ele(p.搜索后列表页.商品项标题s, is_Multiple=True)[position]).sleep(2)

    productname_ele = None
    for index in range(10):
        action.swip_down()
        tmpele = action.find_ele(p.商品详情页.商品参数列表)
        goods_value_eles = action.find_ele_child(tmpele,
                                                 p.商品详情页.商品参数列表_商品参数值s,
                                                 is_Multiple=True,
                                                 wait=3)
        if len(goods_value_eles) > 0:
            productname_ele = goods_value_eles[0]
            break
    if productname_ele == None:
        raise NotFoundElementError

    action.get_img('商品详情页')
    productname = action.get_text_ele(productname_ele)

    return productname