Esempio n. 1
0
    pageBtnNum = len(pageBtnList)
    print("翻页按钮数为:", pageBtnNum)
    if goodsNum % 10 == 0:
        pageNum = goodsNum // 10
    else:
        pageNum = goodsNum // 10 + 1

    if goodsNum <= 10:
        if pageNum == pageBtnNum:  # 只有1页时相等
            print("only onepage right")
        else:
            print("page error")
    else:
        if pageNum == pageBtnNum - 1:  # 大于1页时,页数+下一页
            print("page right")
        else:
            print("page error")


if __name__ == "__main__":
    bonusInst = ComOperation()
    bonusInst.openPages(first_level="推广管理", second_level="红包管理")
    # switch_bonusSetting()
    # for i in range(1):
    #     send_bonus()

    # shield_bonus(False)
    # activate_bonus(False)
    # create_bonus(quantity=5, expiresType=1, limitType="all", boolCreate=True)
    # get_dataTables_info()
Esempio n. 2
0
    browser.find_element_by_css_selector(".fa.fa-search").click()  # 通过类名查找搜索按钮


def registe_buyer():
    # browser.find_element_by_css_selector("#datatatle > tbody > tr:nth-child(1) > td:nth-child(8) > a").click()
    browser.find_element_by_css_selector(".fa.fa-plus-square").click()
    locator = (By.ID, "phone")
    phoneInput = buyerInst.wait_element_visible(locator, 2)
    if phoneInput is not False:
        phoneInput.send_keys("19914863532")
        browser.find_element_by_css_selector("#password").send_keys("123456")
        browser.find_element_by_css_selector("#phoneFormBut").click()
        buyerInst.close_SweetAlert()
    else:
        pass


def see_buyer_detail():
    goodHref = browser.find_elements_by_link_text("详细")
    if len(goodHref) > 0:
        goodHref[0].click()
    else:
        pass


if __name__ == "__main__":
    buyerInst.openPages(first_level="用户管理", second_level="买家管理")
    # filter_condition()
    # registe_buyer()
    see_buyer_detail()
Esempio n. 3
0
                                time.localtime(time.time())))  # 最多应该是5s,为啥是10s
            print("*********", saleFlag)
            if saleFlag is not False:
                warehouseInst.close_SweetAlert()
                browser.refresh()
            else:
                browser.find_element_by_name("supplierPrice").send_keys("3.33")
                browser.find_element_by_name("warehousePrice").send_keys(
                    "4.44")
                browser.find_element_by_id("goodsFormBut").click()
                time.sleep(1)
                warehouseInst.close_SweetAlert()
    else:
        print("没有输入")


def see_oplog():
    warehouseInst.see_oplog()
    time.sleep(2)
    warehouseInst.close_modal_content()


if __name__ == "__main__":
    warehouseInst.openPages(first_level="用户管理", second_level="配送中心管理")
    # add_warehouse()
    # modify_deliveryPoint()
    # see_oplog()
    # filter_condition()
    # forward_warehouse_detail()
    sale_warehouse_goods()
Esempio n. 4
0
        ele.click()
        print("下架成功")

    else:
        print("暂无数据")


def see_oplog():
    goodWatikiInst.see_oplog()
    time.sleep(2)
    goodWatikiInst.close_modal_content()


def see_goods_detail(goodName="八桂大明山包装饮用水18L"):
    goodHref = browser.find_element_by_link_text(goodName)
    goodHref.click()
    print(goodHref.text)


if __name__ == "__main__":
    goodWatikiInst.openPages(first_level="水票管理", second_level="平台水票管理")
    goodWatikiInst.select_city(city="南宁市")
    # filter_condition()
    # watiki_order()
    # add_ticket()
    # add_watikiMeal(2)
    # show_rule()
    # put_off_shelves()
    see_oplog()
    # see_goods_detail()
Esempio n. 5
0
    click_OK_box()

def click_OK_box():
    """操作成功,点击OK"""
    locator = (By.CSS_SELECTOR,".sweet-alert.showSweetAlert.visible")
    confirm_btn = wait_element_visible(locator)
    if confirm_btn:
        browser.find_element_by_css_selector(".sa-confirm-button-container>.confirm").click()
    else:
        pass

def wait_element_visible(locator,timeOut = 5):
    """
    等待页面某个元素出现
    :param locator: 元素定位
    :param timeOut: 等待超时
    :return: 元素出现,返回元素定位,否则返回False
    """
    try:
        #元素出现,返回元素的定位
        return ui.WebDriverWait(browser,timeOut).until(EC.visibility_of_element_located(locator))
    except Exception:
        return False



if __name__ == "__main__":
    paraSetInst = ComOperation()
    paraSetInst.openPages(first_level="系统设置", second_level="参数设置")
    switch_to_DeliveryDistance()
    set_DeliveryDistance(distance=100)
Esempio n. 6
0
            browser.find_element_by_id("scareBut").click()
            seckillInst.close_SweetAlert()
    else:
        pass


def filter_condition():
    """
     搜索:选择过滤条件
    :return:
    """
    Select(browser.find_element_by_name("status")).select_by_visible_text(
        "已结束")  # 活动状态
    Select(browser.find_element_by_name("type")).select_by_visible_text("请选择")
    # browser.find_element_by_name("key").send_keys("")   # 输入搜索字段
    # 点击搜索按钮
    browser.find_element_by_css_selector(".fa.fa-search").click()  # 通过类名查找搜索按钮


def see_oplog():
    browser.find_element_by_css_selector(
        "button[data-url *= '/seo/seckill/oplog/10024']").click()
    time.sleep(3)
    seckillInst.close_modal_content()


if __name__ == "__main__":
    seckillInst.openPages(first_level="推广管理", second_level="抢购活动")
    browser.find_element_by_link_text("广州市").click()
    filter_condition()
Esempio n. 7
0
def op_deliveryPoint_detail():
    browser.find_element_by_css_selector(
        "a[href *= '/users/delivery_point/detail_goods/494430']").click()
    stop_point_goods()


def stop_point_goods():
    goodsList = browser.find_elements_by_css_selector(
        "button[data-url *= '/users/delivery_point/detail_goods/stop']")
    if len(goodsList) > 0:
        goodsList[0].click()
        time.sleep(1)
        browser.find_element_by_css_selector(
            ".sa-confirm-button-container").click()
        time.sleep(1)
        deliveryPointInst.close_SweetAlert()
    else:
        pass


if __name__ == "__main__":
    deliveryPointInst.openPages(first_level="用户管理", second_level="配送点管理")
    # filter_condition()
    # modify_deliveryPoint()
    # delete_deliveryPoint()
    # see_oplog()
    # switch_shopType()
    # add_deliveryPoint()
    op_deliveryPoint_detail()
Esempio n. 8
0
            "div.addresslist.more > div:nth-child(2)").click()
        payType = browser.find_elements_by_css_selector(
            "input[name = 'paytype']")
        payType[1].click()
        browser.find_element_by_css_selector(".col-md-12.J-addgood").click()
    except Exception as errMsg:
        print(errMsg)
    # 添加商品
    try:
        addBtn = browser.find_elements_by_css_selector(".changnum.increase")
        if len(addBtn) > 0:
            addBtn[1].click()
            browser.find_element_by_id("addgoodsBut").click()
            # 选择送达时间
            Select(browser.find_element_by_id(
                "J_deliveryDay")).select_by_visible_text("11月09日 今天")
            Select(browser.find_element_by_id(
                "J_deliveryHour")).select_by_visible_text("尽快送达")
            browser.find_element_by_id("noteorder").send_keys("订单要尽快送达哦")
            browser.find_element_by_id("noteoperation").send_keys("自动化下单的")
            browser.find_element_by_id("orderFormBut").click()
            orderOfflineInst.close_SweetAlert()
        else:
            print("该收货地址没有商品")
    except Exception as errMsg:
        print(errMsg)


if __name__ == "__main__":
    orderOfflineInst.openPages(first_level="订单管理", second_level="线下订单")
    order_add()
Esempio n. 9
0
        pass


def see_oplog():
    deliveryManInst.see_oplog()
    time.sleep(2)
    deliveryManInst.close_modal_content()


def modify_workStatus():
    modifyBtn = browser.find_elements_by_css_selector(
        "button[data-url *= '/users/delivery_man/modifyWorkStatus']")
    if len(modifyBtn) > 0:
        modifyBtn[0].click()
        time.sleep(1)
        browser.find_element_by_id("userssort1").click()
        browser.find_element_by_id("statusBut").click()
        deliveryManInst.close_SweetAlert()
    else:
        pass


if __name__ == "__main__":
    deliveryManInst.openPages(first_level="用户管理", second_level="配送员管理")
    # filter_condition()
    # set_workTime()
    # add_deliveryMan()
    # set_largeOrder()
    # see_oplog()
    modify_workStatus()
Esempio n. 10
0
# 一次弹窗处理
def sweet_alter_visble():
    locator = (By.CSS_SELECTOR, ".sweet-alert.showSweetAlert.visible")
    WebDriverWait(browser, 3).until(EC.visibility_of_element_located(locator))
    if True:
        browser.find_element_by_css_selector(
            ".sa-confirm-button-container").click()  # 是的,显示评价!
        confirm_ok()
    else:
        browser.find_element_by_css_selector(
            ".sa-button-container>button").click()  # 取消弹窗


# 操作成功弹窗关闭
def confirm_ok():
    locator = (By.CSS_SELECTOR, ".sweet-alert.showSweetAlert.visible")
    WebDriverWait(browser, 3).until(EC.visibility_of_element_located(locator))
    time.sleep(1)
    browser.find_element_by_css_selector(
        ".sa-confirm-button-container").click()  # OK


if __name__ == "__main__":
    commentInst = ComOperation()
    commentInst.openPages(first_level="商品管理", second_level="评价管理")
    # search_comment()
    # #delete_comment()
    # recover_comment()
    # export_excel()
Esempio n. 11
0
                      4).until(EC.visibility_of_any_elements_located(locator))
        sponsorList = browser.find_elements_by_css_selector(
            "li[class^='select2-results__option']")  # 类名以value值开头
        resultText = sponsorList[0].text
        if resultText == "未找到结果":
            pass
        else:
            sponsorList[0].click()

        browser.find_element_by_css_selector(".btn.btn-primary").click()
        # 执行成功,需要关闭OK对话框
        self.click_confirm_window()

    #点击确定
    def click_confirm_window(self):
        time.sleep(1)
        locator = (By.CSS_SELECTOR, ".sweet-alert.showSweetAlert.visible")
        WebDriverWait(browser,
                      3).until(EC.visibility_of_element_located(locator))
        browser.find_element_by_css_selector(
            ".sa-confirm-button-container").click()  # 点击OK


if __name__ == "__main__":
    grouBuyInst = ComOperation()
    grouBuyInst.openPages(first_level="推广管理", second_level="团购活动")
    groupbuy = GroupBuy()
    groupbuy.add_groupBuy()
    time.sleep(2)
    browser.quit()
Esempio n. 12
0
def filter_condition(status="活动状态"):
    """
     搜索:选择过滤条件
    :return:
    """
    Select(browser.find_element_by_name("status")).select_by_visible_text(
        status)  # 活动状态
    # Select(browser.find_element_by_name("type")).select_by_visible_text("请选择")
    # browser.find_element_by_name("key").send_keys("")   # 输入搜索字段
    # 点击搜索按钮
    browser.find_element_by_css_selector(".fa.fa-search").click()  # 通过类名查找搜索按钮


def oplog_bonus_activity():
    """
    活动记录
    :return:
    """
    oplogBtn = browser.find_elements_by_css_selector(
        "button[data-url *= '/bonus_activity/oplog']")
    if len(oplogBtn) > 0:
        oplogBtn[0].click()
        bonusActivityInst.close_modal_content()
    else:
        pass


if __name__ == "__main__":
    bonusActivityInst.openPages(first_level="推广管理", second_level="领取红包活动")
    oplog_bonus_activity()
Esempio n. 13
0
                    print("submitRes:", submitRes.text)
                    if "成功" in submitRes.text:
                        # 正常更换
                        orderOnlineInst.close_SweetAlert()
                        print("更换成功!新的配送员是:", staffNew)
                    else:
                        # 配送员不正确或配送员当前状态不能接单
                        orderOnlineInst.close_SweetAlert()
                        time.sleep(1)
                        browser.find_element_by_css_selector(
                            "div.modal-content > div.modal-footer > button.btn.btn-default"
                        ).click()
                        print("配送员不是正常接单状态...")
                else:
                    # 配送员不存在
                    print("staffExist:", staffExist.text)
                    orderOnlineInst.close_SweetAlert()
                    time.sleep(1)
                    browser.find_element_by_css_selector(
                        "div.modal-content > div.modal-footer > button.btn.btn-default"
                    ).click()
        else:
            print("更换配送员-弹窗失败")
    else:
        print("更换配送员-查找按钮失败")


if __name__ == "__main__":
    orderOnlineInst.openPages(first_level="订单管理", second_level="全部订单")
    order_change_deliveryman()
Esempio n. 14
0
def filter_condition(status = "活动状态"):
    """
     搜索:选择过滤条件
    :return:
    """
    browser.find_element_by_name("starttime").send_keys("2018-10-01 00:00:00")   # 输入搜索字段
    # browser.find_element_by_id("dpOkInput").click()
    browser.find_element_by_name("endtime").send_keys("2018-10-31 23:59:59")  # 输入搜索字段
    # browser.find_element_by_id("dpOkInput").click()
    # 点击搜索按钮
    browser.find_element_by_css_selector(".fa.fa-search").click()  # 通过类名查找搜索按钮





if __name__ == "__main__":
    tradeInst.openPages(first_level = "财务管理",second_level = "交易明细")
    filter_condition()










Esempio n. 15
0
    """
    from time import sleep
    sleep(2)
    Select(browser.find_element_by_name("status")).select_by_visible_text(
        "正常")  # 用户状态
    # 点击搜索按钮
    browser.find_element_by_css_selector(".fa.fa-search").click()  # 通过类名查找搜索按钮


def modify_supplier():
    """
    修改配送中心 - 页面与添加配送中心一样,按照需求修改即可
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url *= '/users/supplier/edit/458207']").click()


def see_oplog():
    supplierInst.see_oplog()
    time.sleep(2)
    supplierInst.close_modal_content()


if __name__ == "__main__":
    supplierInst.openPages(first_level="用户管理", second_level="供应商管理")
    # add_supplier()
    # filter_condition()
    # modify_supplier()
    see_oplog()
Esempio n. 16
0
    pageBtnNum = len(pageBtnList)
    print("翻页按钮数为:", pageBtnNum)
    if goodsNum % 10 == 0:
        pageNum = goodsNum // 10
    else:
        pageNum = goodsNum // 10 + 1

    if goodsNum <= 10:
        if pageNum == pageBtnNum:  # 只有1页时相等
            print("only onepage right")
        else:
            print("page error")
    else:
        if pageNum == pageBtnNum - 1:  # 大于1页时,页数+下一页
            print("page right")
        else:
            print("page error")


if __name__ == "__main__":
    cityGoodsInst = ComOperation()
    cityGoodsInst.openPages(first_level="商品管理", second_level="城市商品管理")
    # select_city()
    #search_setting()
    #first_shelf()
    #edit_cityGoods()
    #put_off_shelves()
    #see_operate_logs()
    #export_excel()
    #settlement_info()
    # get_dataTables_info()
Esempio n. 17
0
    time.sleep(2)
    browser.find_element_by_css_selector(
        ".sa-confirm-button-container").click()
    time.sleep(1)
    focusSetInst.close_SweetAlert()


def modify_focus_ad():
    """
    修改焦点广告
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url *= '/seo/ad/edit/110']").click()


def see_rules_declaration():
    """
    查看规则说明
    :return:
    """
    browser.find_element_by_css_selector(
        ".btn.btn-default.btn-sm.explain").click()
    time.sleep(2)
    focusSetInst.close_modal_content()


if __name__ == "__main__":
    focusSetInst.openPages(first_level="推广管理", second_level="焦点设置")
    see_rules_declaration()
Esempio n. 18
0
        browser.find_element_by_css_selector("input[name = 'remarks']").send_keys("自动化测试")
        # browser.find_element_by_css_selector(".btn.btn-primary").click()
        browser.find_element_by_id("makeorderBut").click()
        time.sleep(2)
        # orderWatikiInst.close_SweetAlert()
    else:
        pass

def see_settle_detailed():
    serverList = browser.find_elements_by_css_selector(".fa.fa-server")
    if len(serverList) > 0:
        serverList[0].click()
        time.sleep(2)
        orderWatikiInst.close_modal_content()
        # orderWatikiInst.close_SweetAlert()
    else:
        pass

if __name__ == "__main__":
    orderWatikiInst.openPages(first_level = "水票管理",second_level = "已售出平台水票")
    orderWatikiInst.select_city(city = "南宁市")
    # filter_condition()
    # see_watiki_details()
    # see_oplog()
    # refund_watiki()
    # exchange_watiki()
    see_settle_detailed()



Esempio n. 19
0
    goodsNum = int(findResult[1])  # 共多少条记录
    pageBtnList = browser.find_elements_by_css_selector("li[class^='paginate_button']")  # 共多少页
    pageBtnNum = len(pageBtnList)
    print("翻页按钮数为:", pageBtnNum)
    if goodsNum % 10 == 0:
        pageNum = goodsNum // 10
    else:
        pageNum = goodsNum // 10 + 1

    if goodsNum <= 10:
        if pageNum == pageBtnNum:  # 只有1页时相等
            print("only onepage right")
        else:
            print("page error")
    else:
        if pageNum == pageBtnNum - 1:  # 大于1页时,页数+下一页
            print("page right")
        else:
            print("page error")


if __name__ == "__main__":
    publishgoodsInst = ComOperation()
    publishgoodsInst.openPages(first_level="商品管理", second_level="商品库管理")
    # search_setting()
    # add_goods()
    # see_logs()
    # export_excel()
    # get_dataTables_info()
Esempio n. 20
0
    邀请人默认值设置
    :return:
    """
    browser.find_element_by_link_text("邀请人管理").click()
    browser.find_element_by_css_selector(
        "button[data-url *= '/seo/partner/default']").click()
    locator = (By.ID, "day")
    dayInput = partnerInst.wait_element_visible(locator)
    if dayInput is not False:
        # 输入框原本有默认值,需要清空再输入
        dayInput.clear()
        dayInput.send_keys("365")
        commisInput = browser.find_element_by_id("commission")
        commisInput.clear()
        commisInput.send_keys(20)
    else:
        pass
    browser.find_element_by_id("biguserBut").click()
    time.sleep(1)
    partnerInst.close_SweetAlert()


def personal_promotion_effect():
    browser.find_element_by_link_text("邀请人管理").click()
    browser.find_element_by_link_text("桃子").click()


if __name__ == "__main__":
    partnerInst.openPages(first_level="推广管理", second_level="连你邀请人")
    personal_promotion_effect()