Exemplo n.º 1
0
 def choose_baby_category(self):
     # 输入关键词搜索,选中女装类目
     init_element(self.baby_category_locator).click()
     sleep(5)
     ReleaseCommonMethods().search_keyword('女装/女士精品>>连衣裙',
                                           poco(text="女装/女士精品>>连衣裙"))
     locate_by_anchor(poco(text="保证金1000/订单险/账期保障"), 1, 'l0').click()
 def any_drop_fail(self):
     # 进入任意降页面
     self.auction_common.arbitrary_drop_page()
     # 输入拍卖数量,起拍价,保底价
     self.auction_common.number_and_price(1, 8888, 88888)
     # 设置时间
     self.auction_common.set_time()
     # 输入降价幅度和保证金,点击'计算降价周期'按钮
     self.auction_common.reduction_and_margin(888, 999)
     # 选择宝贝
     self.auction_common.choose_products()
     # 点击上架预展
     init_element(self.on_preview_locator).click()
     # 上架预展前判断是否需要授权
     if init_element(self.impower_locator).exists():
         self.auction_common.impower()
         # 点击上架预展
         init_element(self.on_preview_locator).click()
     # 断言
     try:
         # 确定上架预展是否存在
         poco(text='确定上架预展').exists()
         poco(text='确定上架预展').click()
     except Exception:
         return False
 def reduction_and_margin(self, price_cut, earnest_money):
     # 降价幅度
     poco(name='android.widget.EditText')[3].set_text(price_cut)
     # 保证金
     poco(name='android.widget.EditText')[4].set_text(earnest_money)
     # 点击'计算降价周期'按钮
     init_element(self.price_cycle_button).click()
    def no_price_num(self):
        # 添加主图
        self.add_main_pictures()
        # 编辑宝贝标题
        self.edit_baby_title()
        # 选择宝贝类目
        self.choose_baby_category()
        # 添加年份季节
        self.add_year_season()
        # 滑至底部
        BasePage().page_swipe_buttom02()
        # 运费
        self.choose_freight_template()
        # 店铺分类

        # 上滑至顶部
        self.page_swipe_top_release()
        # 详情描述
        self.add_details_description()
        # 立即发布
        self.immediately_release()

        try:
            poco(name='成功发布到出售中').wait_for_appearance(5)
            print(poco(name='成功发布到出售中 '))
        except PocoTargetTimeout:
            return False
    def no_pictures(self):
        # 编辑宝贝标题
        self.edit_baby_title()
        # 选择宝贝类目
        self.choose_baby_category()
        # 滑至底部
        BasePage().page_swipe_buttom02()
        # 一口价和数量
        self.price_and_quantity()
        confirm_button = poco(name='确定')
        confirm_button.click()
        # 运费
        self.choose_freight_template()
        # 上滑至顶部
        self.page_swipe_top_release()
        # 详情描述
        self.add_details_description()
        # 立即发布
        self.immediately_release()

        try:
            poco(name='成功发布到出售中').wait_for_appearance(5)
            print(poco(name='成功发布到出售中'))
        except PocoTargetTimeout:
            return False
Exemplo n.º 6
0
 def place_and_store_category(self):
     # 切换回基本信息
     init_element(self.basic_information_locator).click()
     BasePage().page_swipe_buttom()
     # init_element(self.place_locator).click()
     init_element(self.store_category_locator).click()
     locate_by_anchor(poco(text="一级分类00"), 2, 'l0l0').click()
     poco(text="确定").click()
 def choose_products(self):
     # 等待页面跳转成功
     init_element(self.choose_products_locator).wait_for_appearance(10)
     # 点击'+'
     locate_by_anchor(init_element(self.choose_products_locator), 1,
                      'v0').click()
     # 搜索宝贝,点击'复制宝贝'
     CommonList().search_by_keyword('测试宝贝不发货', poco(text='测试宝贝不发货不发货'))
     poco(text='测试宝贝不发货不发货').click()
     init_element(self.copy_baby_button).click()
Exemplo n.º 8
0
 def search_keyword(self, keyword, element):
     does_item_search = True
     # 输入搜索的关键字后,点击搜索
     poco(name='android.widget.EditText').set_text(keyword)
     element_click(self.search02_locator)
     try:
         sleep(3)  # 3秒sleep,搜索完成前,页面上存在的元素使显示等待无实际作用
         element.wait_for_appearance(10)  # 列表搜索,10秒显示等待
     except:
         does_item_search = False
     return does_item_search
Exemplo n.º 9
0
 def add_year_season(self):
     init_element(self.year_season_locator).wait_for_appearance(8)
     init_element(self.year_season_locator).click()
     # 显性等待跳转到宝贝属性页面
     init_element(self.baby_attribute_locator).wait_for_appearance(8)
     init_element(self.year_season_locator).click()
     poco(text="2016年冬季").click()
     init_element(self.article_number_locator).wait_for_appearance(8)
     locate_by_anchor(init_element(self.article_number_locator), 2,
                      'l1l0l0').set_text('00123')
     init_element(self.save_locator).click()
 def find_price(self):
     price = poco("com.taobao.qianniu:id/lyt_ge_view_container").child("android.widget.FrameLayout").child(
         "android.widget.FrameLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout")[
         0].offspring("android.widget.ScrollView").child("android.widget.FrameLayout").child(
         "android.widget.FrameLayout").child("android.widget.FrameLayout")[0].child(
         "android.widget.FrameLayout").child("android.widget.FrameLayout").offspring("android.widget.EditText")
     return price
 def nine_activities_successful(self):
     # 进入九块九页面
     self.auction_common.nine_page()
     # 选择宝贝
     self.auction_common.choose_products()
     # 输入拍卖数量
     self.auction_common.auction_number(1)
     # 修改活动时间
     self.auction_common.activity_time()
     # 点击上架预展
     self.auction_common.click_on_preview_button()
     # 上架预展前判断是否需要授权
     if init_element(self.impower_locator).exists():
         self.auction_common.impower()
         # 点击上架预展
         self.auction_common.click_on_preview_button()
     sleep(5)
     # 返回拍卖主页
     poco(name="com.taobao.qianniu:id/qn_widmill_nav_bar_back_btn").click()
 def nine_activities_fail(self):
     # 进入九块九页面
     self.auction_common.nine_page()
     # 选择宝贝
     self.auction_common.choose_products()
     # 输入拍卖数量
     self.auction_common.auction_number(999)
     # 点击上架预展
     init_element(self.on_preview_locator).click()
     # 上架预展前判断是否需要授权
     if init_element(self.impower_locator).exists():
         self.auction_common.impower()
         # 点击上架预展
         init_element(self.on_preview_locator).click()
     # 断言
     try:
         # 确定上架预展是否存在
         poco(text='确定上架预展').exists()
         poco(text='确定上架预展').click()
     except Exception:
         return False
 def pat_increase_warehouse(self):
     # 进入增价拍页面
     self.auction_common.pat_increase_page()
     # 选择宝贝
     self.auction_common.choose_products()
     # 输入起拍价,加价规则
     self.auction_common.rules_for_starting_price(123456, 321)
     # 输入重复上架,封顶价
     self.auction_common.repetition_and_top_price(0, 0)
     # 设置时间
     self.auction_common.set_time()
     # 点击放入仓库中
     self.auction_common.in_warehouse()
     # 放入仓库中之前判断是否需要授权
     if init_element(self.impower_locator).exists():
         self.auction_common.impower()
         # 点击放入仓库中
         self.auction_common.in_warehouse()
     sleep(5)
     # 返回拍卖主页
     poco(name="com.taobao.qianniu:id/qn_widmill_nav_bar_back_btn").click()
 def any_drop_warehouse(self):
     # 进入任意降页面
     self.auction_common.arbitrary_drop_page()
     # 输入拍卖数量,起拍价,保底价
     self.auction_common.number_and_price(1, 100, 88)
     # 设置时间
     self.auction_common.set_time()
     # 输入降价幅度和保证金,点击'计算降价周期'按钮
     self.auction_common.reduction_and_margin(5, 999)
     # 选择宝贝
     self.auction_common.choose_products()
     # 点击放入仓库中
     self.auction_common.in_warehouse()
     # 放入仓库中之前判断是否需要授权
     if init_element(self.impower_locator).exists():
         self.auction_common.impower()
         # 点击放入仓库中
         self.auction_common.in_warehouse()
     sleep(5)
     # 返回拍卖主页
     poco(name="com.taobao.qianniu:id/qn_widmill_nav_bar_back_btn").click()
 def number_and_price(self, number2, starting_price, base_price):
     # 输入拍卖数量
     poco(name='android.widget.EditText').set_text(number2)
     # 起拍价
     poco(name='android.widget.EditText')[1].set_text(starting_price)
     # 保底价
     poco(name='android.widget.EditText')[2].set_text(base_price)
 def price_is_empty(self):
     # 进入增价拍页面
     self.auction_common.pat_increase_page()
     # 选择宝贝
     self.auction_common.choose_products()
     # 输入重复上架,封顶价
     self.auction_common.repetition_and_top_price(9, 999999)
     # 设置时间
     self.auction_common.set_time()
     # 点击上架预展
     init_element(self.on_preview_locator).click()
     # 上架预展前判断是否需要授权
     if init_element(self.impower_locator).exists():
         self.auction_common.impower()
         # 点击上架预展
         init_element(self.on_preview_locator).click()
     # 断言
     try:
         # 确定上架预展是否存在
         poco(text='确定上架预展').exists()
         poco(text='确定上架预展').click()
     except Exception:
         return False
 def set_time(self):
     # 打开日历
     locate_by_anchor(init_element(self.starting_time_locator), 1,
                      'l1l1').click()
     # 点击确定
     poco(text="确定").click()
     # 切换到输入模式,获取分钟的文本信息,基础上加2分钟,如果到58时,则获取小时的文本,基础上加1小时
     init_element(self.input_pattern).click()
     minute1 = init_element(self.minute_locator).get_text()
     if int(minute1) == 58:
         hour1 = init_element(self.hour_locator).get_text()
         hour2 = int(hour1) + 1
         element_sendtext(self.hour_locator, hour2)
         # 点击确定
         poco(name="android:id/button1").click()
     else:
         minute2 = int(minute1) + 2
         element_sendtext(self.minute_locator, minute2)
         # 点击确定
         poco(name="android:id/button1").click()
Exemplo n.º 18
0
 def in_warehouse_success(self):
     return poco(text='成功发布到仓库中').exists()
Exemplo n.º 19
0
 def release_success(self):
     return poco(text='成功发布到出售').exists()
Exemplo n.º 20
0
 def add_details_description(self):
     init_element(self.details_description_locator).click()
     init_element(self.add_text_locator).click()
     locate_by_anchor(poco(text='取消'), 2,
                      'v0v0v0v0').set_text('发布宝贝测试,不发货不发货不发货不发货不发货......')
     poco(text="确定").click()
Exemplo n.º 21
0
    def choose_freight_template(self):

        init_element(self.freight_locator).click()
        poco(text="我的模板1").click()
        poco(text="确认").click()
 def impower(self):
     poco(name="android:id/button2").click()
     poco(name='com.taobao.qianniu:id/open_auth_btn_grant').click()
 def arbitrary_drop_page(self):
     locate_by_anchor(poco(text='任意降'), 2, 'v3v1').click()
 def pat_increase_page(self):
     locate_by_anchor(poco(text='增价拍'), 2, 'v3v1').click()
Exemplo n.º 25
0
 def price_and_quantity(self):
     poco('android.widget.RelativeLayout').swipe('down')
     # BasePage().page_swipe_buttom02()
     init_element(self.fixed_price_locator).click()
     poco(text='设置规格').wait_for_appearance(8)
     # 选择尺码
     init_element(self.choose_size_locator).click()
     poco(text="145/52A").click()
     poco(text="155/60A").click()
     poco(text='确定').click()
     init_element(self.choose_size_locator).invalidate()
     # 选择颜色
     sleep(3)
     init_element(self.choose_color_locator).click()
     poco(text="乳白色").click()
     poco(text="米白色").click()
     init_element(self.sure2_locator).click()
     # 批量填充价格和库存
     poco(text="批量填充").invalidate()
     poco(text="批量填充").click()
     locate_by_anchor(poco(text='价格'), 1, 'l1l0l0').set_text('10000000')
     locate_by_anchor(poco(text='库存'), 1, 'l1l0l0').set_text('999')
     poco(text="确认").click()
     poco(text="确定").click()
 def activity_time(self):
     poco(text="09:00-12:00").click()
     poco(text="9:00-12:00").click()