コード例 #1
0
def order_watiki():
    eleList = browser.find_elements_by_css_selector(".fa.fa-arrows-v")
    if len(eleList) > 0:
        eleList[0].click()
        locator = (By.CSS_SELECTOR, ".form-control.sort")
        sortInput = ComOperation.wait_element_visible(locator, 2)
        print("sortInput is :", type(sortInput))
        if sortInput is not None:
            sortInput.clear()
            sortInput.send_keys("301")
            browser.find_element_by_id("watersortBut").click()
            goodWatikiInst.close_SweetAlert()
        else:
            pass
    else:
        print("水票列表为空")
コード例 #2
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()
コード例 #3
0
# -*- coding: utf-8 -*-
'''
# 用户管理/配送中心管理
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
warehouseInst = ComOperation()


def add_warehouse():
    """
    添加配送中心
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url *= '/users/warehouse/add']").click()
    locator = (By.CSS_SELECTOR, "input[placeholder = '配送中心名称']")
    inputName = warehouseInst.wait_element_visible(locator)
    if warehouseInst is not False:
        inputName.send_keys("南宁第二配送中心")
        browser.find_element_by_css_selector(
            "input[placeholder = '认证手机']").send_keys("18914863531")
        Select(browser.find_element_by_id("province")).select_by_visible_text(
            "广西")
コード例 #4
0
ファイル: buyer.py プロジェクト: wxt151/lnlife
# -*- coding: utf-8 -*-
'''
# 用户管理/买家管理
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
buyerInst = ComOperation()


def filter_condition():
    """
    全部买家 搜索
    :return:
    """
    # 选择过滤条件
    from time import sleep
    sleep(2)
    Select(browser.find_element_by_name("interest")).select_by_visible_text(
        "已关注")  # 关注状态
    Select(browser.find_element_by_name("pstatus")).select_by_visible_text(
        "已认证")  # 认证手机状态
    Select(browser.find_element_by_name("status")).select_by_visible_text(
        "用户状态")  # 用户状态
コード例 #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)
コード例 #6
0
ファイル: seckill.py プロジェクト: wxt151/lnlife
# -*- coding: utf-8 -*-
'''
# 推广管理/抢购活动
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
seckillInst = ComOperation()


def additional_seckill():
    """
    追加抢购活动
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url *= '/seo/seckill/additional/10023']").click()
    time.sleep(1)

    locator = (By.CSS_SELECTOR, ".sweet-alert.showSweetAlert.visible")
    Alert_ele = seckillInst.wait_element_visible(locator)
    if Alert_ele is not False:
        # 1.该商品存在尚未结束的抢购活动
        # 2.当前城市没有出售该水票(商品)或者已下架
        print(Alert_ele.text)
コード例 #7
0
# -*- coding: utf-8 -*-
'''
# 用户管理/配送点管理
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser

deliveryPointInst = ComOperation()


def add_deliveryPoint():
    browser.find_element_by_css_selector(
        "button[data-url *= '/users/delivery_point/add']").click()
    locator = (By.CSS_SELECTOR, "input[name = 'phone']")
    inputPhone = deliveryPointInst.wait_element_visible(locator)
    if inputPhone is not False:
        inputPhone.send_keys("18914863532")
        browser.find_element_by_name("loginpass").send_keys("123456")
        Select(
            browser.find_element_by_name("city")).select_by_visible_text("南宁市")
        time.sleep(0.5)
        Select(browser.find_element_by_name(
            "distribution")).select_by_visible_text("南宁配送中心")
        browser.find_element_by_id("type1").click()
コード例 #8
0
ファイル: deliveryMan.py プロジェクト: wxt151/lnlife
# -*- coding: utf-8 -*-
'''
# 用户管理/配送员管理
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser

deliveryManInst = ComOperation()


def filter_condition():
    """
    配送员 搜索
    :return:
    """
    # 选择过滤条件
    from time import sleep
    sleep(2)
    Select(browser.find_element_by_name("status")).select_by_visible_text(
        "全部状态")  # 用户状态
    Select(browser.find_element_by_name("workstatus")).select_by_visible_text(
        "接单中")  # 接单状态
    Select(browser.find_element_by_name("level")).select_by_visible_text(
        "普通")  # 配送员职级
コード例 #9
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()
コード例 #10
0
ファイル: groupBuy.py プロジェクト: wxt151/lnlife
                      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()
コード例 #11
0
"""
订单管理/线下订单
"""
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
import time

from admin.modules.comOperation import ComOperation, browser
orderOfflineInst = ComOperation()


def order_add():
    """
    生成线下订单
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url $= '/order/add']").click()
    try:
        locator = (By.NAME, "phone")
        nameInput = orderOfflineInst.wait_element_visible(locator, 5)
        nameInput.send_keys("13878857334")
        browser.find_element_by_css_selector(
            "#phoneform > div:nth-child(2) > ul").click()
        time.sleep(1)
        browser.find_element_by_id("phoneFormBut").click()
    except Exception as errMsg:
        print(errMsg)

    try:
        browser.find_element_by_css_selector(
コード例 #12
0
ファイル: commentControl.py プロジェクト: wxt151/lnlife
# 一次弹窗处理
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()
コード例 #13
0
ファイル: bonusActivity.py プロジェクト: wxt151/lnlife
# -*- coding: utf-8 -*-
'''
# 推广管理/领取红包活动
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
bonusActivityInst = ComOperation()


def additional_bonus_activity():
    """
    追加已经结束的活动
    :return:
    """
    filter_condition(status="已结束")
    additionBtn = browser.find_elements_by_css_selector(
        "button[data-url *= '/bonus_activity/additional']")
    if len(additionBtn) > 0:
        additionBtn[0].click()
        locator = (By.ID, "number")
        numInput = bonusActivityInst.wait_element_visible(locator)
        if numInput is not False:
            numInput.send_keys("3")
            browser.find_element_by_id("reservationtime").send_keys(
コード例 #14
0
# -*- coding: utf-8 -*-
'''
# 财务管理/交易明细
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation,browser
tradeInst = ComOperation()

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()  # 通过类名查找搜索按钮




コード例 #15
0
ファイル: supplier.py プロジェクト: wxt151/lnlife
# -*- coding: utf-8 -*-
'''
# 用户管理/配送中心管理
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
supplierInst = ComOperation()


def add_supplier():
    """
    添加供应商
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url *= '/users/supplier/add']").click()
    locator = (By.CSS_SELECTOR, "input[placeholder = '供应商名称']")
    inputName = supplierInst.wait_element_visible(locator)
    if inputName is not False:
        inputName.send_keys("巴马活泉")
        browser.find_element_by_css_selector(
            "input[placeholder = '认证手机']").send_keys("18914863531")
        Select(browser.find_element_by_id("province")).select_by_visible_text(
            "广西")
コード例 #16
0
# -*- coding: utf-8 -*-
'''
# 水票管理/已售出平台水票
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation,browser
orderWatikiInst = ComOperation()


def filter_condition():
    """
    已售出平台水票 搜索
    :return:
    """
    # 选择过滤条件
    from time import sleep
    sleep(2)
    Select(browser.find_element_by_name("category")).select_by_visible_text("专用水票") # 水票类型
    Select(browser.find_element_by_name("source")).select_by_visible_text("手动生成")   # 水票来源
    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_css_selector("input[name = 'key']").send_keys("花果山") #请输入关键字
    browser.find_element_by_css_selector("input[name = 'timename']").click() # 下单时间
コード例 #17
0
# -*- coding: utf-8 -*-
'''
# 用户管理/焦点设置
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
focusSetInst = ComOperation()


def add_focus_ad():
    """
    添加焦点广告
    :return:
    """
    browser.find_element_by_css_selector(
        "button[data-url *= '/seo/ad/create?type=1&postion_id=3&city=0']"
    ).click()
    locator = (By.NAME, "title")
    titleInput = focusSetInst.wait_element_visible(locator)
    if titleInput is not False:
        titleInput.send_keys("好水任你喝")
        browser.find_element_by_name("jump_url").send_keys(
            "http://wechat6.t-lianni.com/")
        browser.find_element_by_id("reservationtime").send_keys(
コード例 #18
0
# -*- coding: utf-8 -*-
'''
# 水票管理/平台水票管理
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
goodWatikiInst = ComOperation()


def add_watikiMeal(addType=1):
    """
    添加水票
        :param addtype:  添加水票/套餐 ;1 = 套餐,2 = 水票
        :return:
    """
    addBtnList = []
    if addType == 1:
        addBtnList = browser.find_elements_by_css_selector(".fa.fa-cubes")

    elif addType == 2:
        addBtnList = browser.find_elements_by_css_selector(
            ".btn.btn-default.btn-sm.J-add-ticket")
    else:
        print("error parameter !!!")
コード例 #19
0
ファイル: publishGoods.py プロジェクト: wxt151/lnlife
    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()
コード例 #20
0
ファイル: partner.py プロジェクト: wxt151/lnlife
# -*- coding: utf-8 -*-
'''
# 推广管理/连你邀请人
'''

import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select

from admin.modules.comOperation import ComOperation, browser
partnerInst = ComOperation()


def add_partner():
    """
    添加邀请人
    :return:
    """
    browser.find_element_by_link_text("邀请人管理").click()
    browser.find_element_by_css_selector(
        "button[data-url *= '/seo/partner/add']").click()
    locator = (By.CSS_SELECTOR, "input[placeholder = '手机号/ID']")
    phoneIDInput = partnerInst.wait_element_visible(locator)
    if phoneIDInput is not False:
        phoneIDInput.send_keys("19914863531")
    else:
        pass