import time
from selenium import webdriver

from tool.loginFile.login import Login
from tool.random.randomPerson import RandomStaff
from tool.random.randomPhone import RandomPhone
from tool.random.randomSupplier import RandomSupplier
from tool.time.loadingTime import LoadTime
from tool.time.nowTime import nowTime

url = Login.location(1)
loginname = Login.name(1)
loginpwd = Login.password(1)
tim = nowTime()
time1 = LoadTime.time1(1)
time2 = LoadTime.time2(1)
time3 = LoadTime.time3(1)

gysname = RandomSupplier.supplier_name(1)
personname = RandomStaff.person_name(1)
ph = RandomPhone.phone(1)


# 零售系统供应商信息
def test84():
    try:
        driver = webdriver.Chrome()
        driver.maximize_window()
        driver.implicitly_wait(10)

        driver.get(url)
Example #2
0
def test107():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get(url)

    # 输入账号
    name=driver.find_element_by_id('user')
    name.click()
    name.clear()
    name.send_keys(login_name)

    # 输入密码
    pwd=driver.find_element_by_id('pwd')
    pwd.click()
    pwd.clear()
    pwd.send_keys(login_pwd)

    # 登陆
    driver.find_element_by_xpath('//*[@id="root"]/div/div[1]/div/div/form/div[3]/div/div/span/button').click()
    print('test107:进入批发→分组→厂商设置→厂商信息')

    # 批发管理
    driver.find_element_by_xpath('//*[@id="root"]/section/main/div/div/button[2]').click()

    # 分组
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div/section/main/div/div[2]/div/div[1]/div[2]/div/div/div/div/div/div/div/table/tbody/tr/td[2]/div/a').click()
    time.sleep(time2)


    # 点击商品管理
    # driver.find_element_by_xpath('//*[@id="root"]/div/div[2]/div[1]/div/ul/li[5]/div[1]/span/span').click()

    # time.sleep(time1)

    #厂商信息
    driver.find_element_by_link_text('厂商信息').click()
    time.sleep(time1)
    driver.find_element_by_link_text('新增').click()
    time.sleep(time1)

    # 厂商名称
    csmc = driver.find_element_by_xpath('//*[@id="name"]')
    csmc.click()
    csmc.clear()
    csmc.send_keys(manufacturer)

    # 联系人
    lxrr = driver.find_element_by_xpath('//*[@id="contact"]')
    lxrr.click()
    lxrr.clear()
    lxrr.send_keys(RandomMember.member_name(1))

    # 电话
    gysdh = driver.find_element_by_xpath('//*[@id="tel"]')
    gysdh.click()
    gysdh.clear()
    gysdh.send_keys(phone)

    # 单位地址
    dwdz = driver.find_element_by_xpath('//*[@id="address"]')
    dwdz.click()
    dwdz.clear()
    dwdz.send_keys('成都市天府新区天府菁蓉大厦')
    # 银行卡
    yhk = driver.find_element_by_xpath('//*[@id="bank_card"]')
    yhk.click()
    yhk.clear()
    yhk.send_keys('6214837340093073')

    # 开户行
    khh = driver.find_element_by_xpath('//*[@id="opening_bank"]')
    khh.click()
    khh.clear()
    khh.send_keys('成都')
    # 信用额度
    xyed = driver.find_element_by_xpath('//*[@id="line_of_credit"]')
    xyed.click()
    xyed.clear()
    xyed.send_keys('10000')
    # 备注
    bz = driver.find_element_by_xpath('//*[@id="comment"]')
    bz.click()
    bz.clear()
    bz.send_keys('厂商' + nowTime())

    # 保存
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/button[1]').click()
    time.sleep(time1)
    # 抓取结果
    result_save = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    correct = ('操作成功')
    # 判断是否成功
    if result_save == correct:
        print(manufacturer + ":厂商新建成功\n", "厂商新建功能正常\n")
    else:
        print(result_save + "\n厂商新建异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    time.sleep(time1)

    # 搜索输入
    ygmc = driver.find_element_by_xpath(
        '//*[@id="name"]')
    ygmc.click()
    ygmc.clear()
    ygmc.send_keys(manufacturer)
    # 查询
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]').click()
    time.sleep(time2)

    # 搜素结果获取
    gyscxjg = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[1]/a').text
    if manufacturer == gyscxjg:
        print(manufacturer + ' 等于 ' + gyscxjg, '\n厂商搜索正常\n')
    else:
        print('厂商搜索异常')

    # 厂商编辑
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[10]/div/a[1]/i').click()
    time.sleep(time1)
    # 保存
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/button[1]').click()
    print(manufacturer + ":厂商编辑成功\n", "厂商编辑功能正常\n")
    time.sleep(time2)

    # 搜索输入
    ygmc = driver.find_element_by_xpath(
        '//*[@id="name"]')
    ygmc.click()
    ygmc.clear()
    ygmc.send_keys(manufacturer)
    # 查询
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]').click()
    time.sleep(time2)


    # 点击删除按钮
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[10]/div/a[2]/i').click()
    time.sleep(time1)
    try:
        driver.find_element_by_xpath('/html/body/div[4]/div/div[2]/div/div[2]/div/div/div[2]/button[2]').click()
    except:
        driver.find_element_by_xpath('/html/body/div[5]/div/div[2]/div/div[2]/div/div/div[2]/button[2]').click()
    time.sleep(time1)
    # 抓取结果
    result_delect = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    correct = ('操作成功')
    # 判断是否成功
    if result_delect == correct:
        print(manufacturer + ":厂商删除成功\n", "厂商删除功能正常\n")
    else:
        print(result_delect + "\n厂商删除异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    time.sleep(time1)
    driver.quit()
def test19():
    # try:
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get(url)
    # 输入账号
    name = driver.find_element_by_id('user')
    name.click()
    name.clear()
    name.send_keys(login_name)

    # 输入密码
    pwd = driver.find_element_by_id('pwd')
    pwd.click()
    pwd.clear()
    pwd.send_keys(login_pwd)

    # 登陆
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div[1]/div/div/form/div[3]/div/div/span/button'
    ).click()

    # 零售业务
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/main/div/div/button[1]').click()

    # 进入店铺
    driver.find_element_by_link_text('进入店铺').click()
    time.sleep(time1)

    # 前台业务
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/aside/div/ul/li[7]/div[1]/span/span'
    ).click()
    print('test19:进入零售→店铺→前台业务→零售退货')
    time.sleep(time1)

    # 零售退货
    driver.find_element_by_link_text('零售退货').click()
    time.sleep(time2)

    #查询
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
    ).click()
    time.sleep(time2)

    s1 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[1]/strong'
    ).text
    s2 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[2]/strong'
    ).text
    singular = RandomMember.extract_number(s1)
    shop_money = RandomMember.extract_number(s2)
    print('退 货 前: ' + singular + '件   ' + shop_money + '元   ')
    driver.find_element_by_link_text('新增').click()
    time.sleep(time2)
    # 选择业务导购
    driver.find_element_by_xpath('//*[@id="salesId"]/div/div/div[1]').click()
    time.sleep(time1)
    driver.find_element_by_xpath('/html/body/div[3]/div/div//ul/li[%s]' %
                                 random_number).click()
    time.sleep(time1)

    # 输入备注
    bz = driver.find_element_by_xpath('//*[@id="comment"]')
    bz.click()
    bz.clear()
    bz.send_keys("生成时间" + nowTime())
    #点击会员信息框
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/form/div/div[2]/div/div[1]/div/div/div[2]/div/span/div/div/div/div[1]'
    ).click()
    time.sleep(time1)
    #输入会员名字
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/form/div/div[2]/div/div[1]/div/div/div[2]/div/span/div/div/div/div[2]/div/input'
    ).send_keys(random_number)
    time.sleep(time2)
    #选择搜索出来的会员
    driver.find_element_by_xpath('/html/body/div[4]/div/div//ul/li[%s]' %
                                 random_number).click()

    # 正常退货
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/form/div/div[1]/div[2]/div[1]/div/div[2]/div/button[1]'
    ).click()
    time.sleep(time1)
    # 选择订单
    driver.find_element_by_xpath(
        '/html/body/div[5]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div/div/table/tbody/tr[1]/td[1]/span/label/span/input'
    ).click()
    time.sleep(time2)
    # 确定
    driver.find_element_by_xpath(
        '/html/body/div[5]/div/div[2]/div/div[2]/div[3]/div/button[2]').click(
        )
    time.sleep(time2)

    #获取应收金额
    ysje = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/form/div/div[2]/div/div[7]/div/div[1]/div/div[2]/span'
    ).text
    pay_money = ysje.split('.')[0]
    #现金支付输入
    xjzf = driver.find_element_by_xpath('//*[@id="return_balance"]')
    xjzf.click()
    xjzf.send_keys(pay_money)
    time.sleep(time2)

    #保存
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
    ).click()
    time.sleep(time1)
    # 抓取结果
    result_save = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    correct = ('操作成功')
    # 判断是否成功
    if result_save == correct:
        print('退货单生成成功')
    else:
        print(result_save + "\n零售退货异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    time.sleep(time1)
    #取消打印单据
    try:
        driver.find_element_by_xpath(
            '/html/body/div[6]/div/div[2]/div/div[2]/div/div/div[2]/button[1]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '/html/body/div[7]/div/div[2]/div/div[2]/div/div/div[2]/button[1]'
        ).click()
    time.sleep(time1)
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
    ).click()
    time.sleep(time2)
    s11 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[1]/strong'
    ).text
    s22 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[2]/strong'
    ).text

    singular1 = RandomMember.extract_number(s11)
    singular2 = int(singular) + 1
    number1 = RandomMember.extract_number(s22)
    number2 = int(shop_money) + int(pay_money)

    print('实际退货: 1件  ' + pay_money + '元\n')
    if singular2 == int(singular1) and number2 == int(number1):
        print('退 货 后: ' + singular1 + '件   ' + number1 + '元   \n' + '零售退货正常')
    else:
        print('退货异常!!!!!')
        time.sleep(time1)
    driver.quit()
def test18():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get(url)
    # 输入账号
    name = driver.find_element_by_id('user')
    name.click()
    name.clear()
    name.send_keys(login_name)

    # 输入密码
    pwd = driver.find_element_by_id('pwd')
    pwd.click()
    pwd.clear()
    pwd.send_keys(login_pwd)

    # 登陆
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div[1]/div/div/form/div[3]/div/div/span/button'
    ).click()

    # 零售业务
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/main/div/div/button[1]').click()

    # 进入店铺
    driver.find_element_by_link_text('进入店铺').click()
    time.sleep(time1)

    # 前台业务
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/aside/div/ul/li[7]/div[1]/span/span'
    ).click()
    print('test18:进入零售→店铺→前台业务→零售订单')
    time.sleep(time1)

    # 点击零售订单
    driver.find_element_by_link_text('零售订单').click()
    time.sleep(time2)

    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
    ).click()
    time.sleep(time2)

    s1 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div[3]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/span[1]/strong'
    ).text
    s2 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div[3]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/span[2]/strong'
    ).text
    s3 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div[3]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/span[3]/strong'
    ).text
    singular = RandomMember.extract_number(s1)
    number = RandomMember.extract_number(s2)
    money = RandomMember.extract_number(s3)
    print('下 单 前: ' + singular + '单   ' + number + '件   ' + money + '元   ')
    driver.find_element_by_link_text('新增').click()
    time.sleep(time2)
    # 选择业务导购
    driver.find_element_by_xpath('//*[@id="salesId"]/div/div').click()
    time.sleep(time1)
    driver.find_element_by_xpath('//*[@role="listbox"]/li[%s]' %
                                 random_number).click()
    time.sleep(time1)

    # 输入备注
    bz = driver.find_element_by_xpath('//*[@id="comment"]')
    bz.click()
    bz.clear()
    bz.send_keys("生成时间" + nowTime())
    #点击会员信息框
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[1]/div/div[1]/div[2]/div/span/div/div/div/div[1]'
    ).click()
    time.sleep(time1)
    #输入会员名字
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[1]/div/div[1]/div[2]/div/span/div/div/div/div[2]/div/input'
    ).send_keys(random_number)
    time.sleep(time2)
    #选择搜索出来的会员
    driver.find_element_by_xpath('/html/body/div[4]/div/div/div/ul/li[%s]' %
                                 random_number).click()

    # 点击添加商品框
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[1]/div[2]/div/div/div/div[1]/div/div[2]/span/div/div/div/div/ul/li/div/input'
    ).click()
    time.sleep(time1)
    # 输入商品名字
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[1]/div[2]/div/div/div/div[1]/div/div[2]/span/div/div/div/div/ul/li/div/input'
    ).send_keys(random_number)
    time.sleep(time2)
    # 选择搜索出来的第一个商品
    driver.find_element_by_xpath('/html/body/div[5]/div/div/div/ul/li[%s]' %
                                 random_number).click()
    time.sleep(time2)
    #弹窗商品选择
    gmsp = driver.find_element_by_xpath(
        '/html/body/div[6]/div/div[2]/div/div[2]/div[2]/div/div[1]/div/div/div/div/div[2]/table/tbody/tr[1]/td[2]'
    )
    xdname = gmsp.text
    #鼠标双击选择
    ActionChains(driver).double_click(gmsp).perform()
    time.sleep(time2)
    #获取应收金额
    ysje = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[2]/div/div[1]/div/div[2]/div/div[2]/span'
    ).text
    pay_money = ysje.split('.')[0]
    #现金支付输入
    xjzf = driver.find_element_by_xpath(
        '//*[@id="payment-method"]/div[1]/span/span/input')
    xjzf.click()
    xjzf.send_keys(pay_money)
    time.sleep(time2)
    # 单据数量
    shop_number = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[3]/div/div/div/div[2]/div/div[2]/span'
    ).text
    # 应收金额
    cc = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[3]/div/div/div/div[3]/div/div[2]/span'
    ).text
    shop_money = cc.split('.')[0]
    #保存
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
    ).click()
    time.sleep(time2)
    # 抓取结果
    result_savel = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    time.sleep(time1)
    zi = '支付金额'
    re = '请先'
    resul = zi in result_savel
    resull = re in result_savel
    # 判断是否成功
    if resul == True:
        print(result_savel + "店铺配货异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    elif resull == True:
        print(result_savel + "店铺配货异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    print()
    #取消打印单据
    try:
        driver.find_element_by_xpath(
            '/html/body/div[7]/div/div[2]/div/div[2]/div/div/div[2]/button[1]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '/html/body/div[8]/div/div[2]/div/div[2]/div/div/div[2]/button[1]'
        ).click()
    time.sleep(time1)
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
    ).click()
    time.sleep(time2)
    s11 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div[3]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/span[1]/strong'
    ).text
    s22 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div[3]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/span[2]/strong'
    ).text
    s33 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div[3]/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/span[3]/strong'
    ).text
    singular1 = RandomMember.extract_number(s11)
    singular2 = int(singular) + 1
    number1 = RandomMember.extract_number(s22)
    number2 = int(number) + int(shop_number)
    money1 = RandomMember.extract_number(s33)
    money2 = int(money) + int(shop_money)
    print('实际下单: 1单  ' + shop_number + '件   ' + shop_money + '元\n')
    if singular2 == int(singular1) and number2 == int(
            number1) and money2 == int(money1):
        print('下 单 后: ' + singular1 + '单   ' + number1 + '件   ' + money1 +
              '元   \n' + '零售订单正常')
    else:
        print('下单异常!!!!!')
    driver.quit()
def test20():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get(url)
    # 输入账号
    name = driver.find_element_by_id('user')
    name.click()
    name.clear()
    name.send_keys(login_name)

    # 输入密码
    pwd = driver.find_element_by_id('pwd')
    pwd.click()
    pwd.clear()
    pwd.send_keys(login_pwd)

    # 登陆
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div[1]/div/div/form/div[3]/div/div/span/button'
    ).click()

    # 零售业务
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/main/div/div/button[1]').click()

    # 进入店铺
    driver.find_element_by_link_text('进入店铺').click()
    time.sleep(time1)

    # 前台业务
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/aside/div/ul/li[7]/div[1]/span/span'
    ).click()
    print('test19:进入零售→店铺→前台业务→零售退货')
    time.sleep(time1)

    # 零售订货
    driver.find_element_by_link_text('零售订货').click()
    time.sleep(time2)

    #查询
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
    ).click()
    time.sleep(time2)

    s1 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[1]/strong'
    ).text
    s2 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[2]/strong'
    ).text
    shop_money = RandomMember.extract_number(s1)
    singular = RandomMember.extract_number(s2)
    print('定 货 前: ' + singular + '件   ' + shop_money + '元   ')
    driver.find_element_by_link_text('新增').click()
    time.sleep(time2)
    # 选择业务导购
    driver.find_element_by_xpath('//*[@id="salesId"]/div/div/div[1]').click()
    time.sleep(time1)
    driver.find_element_by_xpath('/html/body/div[3]/div/div//ul/li[%s]' %
                                 random_number).click()
    time.sleep(time1)

    # 输入备注
    bz = driver.find_element_by_xpath('//*[@id="comment"]')
    bz.click()
    bz.clear()
    bz.send_keys("生成时间" + nowTime())
    #点击会员信息框
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[1]/div/div[1]/div[2]/div/span/div/div/div/div[1]'
    ).click()
    time.sleep(time1)
    #输入会员名字
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[1]/div/div[1]/div[2]/div/span/div/div/div/div[2]/div/input'
    ).send_keys(random_number)
    time.sleep(time2)
    #选择搜索出来的会员
    driver.find_element_by_xpath('/html/body/div[4]/div/div//ul/li[%s]' %
                                 random_number).click()

    # 添加商品
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[1]/div[2]/div/div/div/div[1]/div/div[2]/span/div/div/div/div/ul/li/div/input'
    ).click()
    time.sleep(time1)
    # 输入商品名字
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[1]/div[2]/div/div/div/div[1]/div/div[2]/span/div/div/div/div/ul/li/div/input'
    ).send_keys(random_number)
    time.sleep(time2)
    # 选择搜索出来的商品
    driver.find_element_by_xpath('/html/body/div[5]/div/div/div/ul/li[%s]' %
                                 random_number).click()
    time.sleep(time2)
    # 弹窗商品选择
    gmsp = driver.find_element_by_xpath(
        '/html/body/div[6]/div/div[2]/div/div[2]/div[2]/div/div[1]/div/div/div/div/div[2]/table/tbody/tr[1]/td[2]'
    )
    # 鼠标双击选择
    ActionChains(driver).double_click(gmsp).perform()
    time.sleep(time2)
    # 获取应收金额
    ysje = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/form/div/div[2]/div/div[2]/div/div[1]/div/div[2]/div/div[2]/span'
    ).text
    pay_money = ysje.split('.')[0]
    # 现金支付输入
    xjzf = driver.find_element_by_xpath(
        '//*[@id="payment-method"]/div[1]/span/span/input')
    xjzf.click()
    xjzf.send_keys(pay_money)
    time.sleep(time2)
    # 保存
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
    ).click()
    time.sleep(time2)

    # 抓取结果
    result_save = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    correct = ('操作成功')
    # 判断是否成功
    if result_save == correct:
        print('订货成功')
    else:
        print(result_save + "\n订货异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    time.sleep(time1)
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
    ).click()
    time.sleep(time2)
    s11 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[1]/strong'
    ).text
    s22 = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[3]/div/div/span[2]/strong'
    ).text

    shop_money1 = RandomMember.extract_number(s11)
    shop_money2 = int(shop_money) + int(pay_money)
    singular1 = RandomMember.extract_number(s22)
    singular2 = int(singular) + 1

    print('实际订货: 1件  ' + pay_money + '元\n')
    if singular2 == int(singular1) and shop_money2 == int(shop_money1):
        print('订 货 后: ' + singular1 + '件     ' + shop_money1 + '元')
    else:
        a = 1 / 0
        print(a)
    time.sleep(time1)
    driver.quit()
def test109():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get(url)

    # 输入账号
    name = driver.find_element_by_id('user')
    name.click()
    name.clear()
    name.send_keys(Login.name(1))

    # 输入密码
    pwd = driver.find_element_by_id('pwd')
    pwd.click()
    pwd.clear()
    pwd.send_keys(Login.password(1))

    # 登陆
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div[1]/div/div/form/div[3]/div/div/span/button'
    ).click()
    print('test109:进入批发→分组→客户管理→客户管理')

    # 批发管理
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/main/div/div/button[2]').click()

    # 分组
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div/section/main/div/div[2]/div/div[1]/div[2]/div/div/div/div/div/div/div/table/tbody/tr/td[2]/div/a'
    ).click()
    time.sleep(time2)

    # 客户管理
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/aside/div/ul/li[5]/div[1]/span/span'
    ).click()
    time.sleep(time1)

    # 客户信息
    driver.find_element_by_link_text('客户信息').click()
    time.sleep(time1)
    driver.find_element_by_link_text('新增').click()
    time.sleep(time1)

    # 客户名称
    person = driver.find_element_by_xpath('//*[@id="name"]')
    person.click()
    person.clear()
    person.send_keys(menber_name)

    # 客户等级
    driver.find_element_by_xpath(
        '//*[@id="client_level"]/div/div/div[1]').click()
    time.sleep(time1)
    try:
        driver.find_element_by_xpath(
            '/html/body/div[3]/div/div/div/ul/li[1]').click()
    except:
        driver.find_element_by_xpath(
            '/html/body/div[4]/div/div/div/ul/li[1]').click()
    # 负责人
    phone1 = driver.find_element_by_xpath('//*[@id="principal"]')
    phone1.click()
    phone1.clear()
    phone1.send_keys(RandomStaff.person_name(1))

    # 手机号码
    hyarea = driver.find_element_by_xpath('//*[@id="phone"]')
    hyarea.click()
    hyarea.clear()
    hyarea.send_keys(RandomPhone.phone(1))

    # 店铺地址
    hyarea = driver.find_element_by_xpath('//*[@id="address"]')
    hyarea.click()
    hyarea.clear()
    hyarea.send_keys(RandomMember.member_area(1))

    # 座机号码
    hyarea = driver.find_element_by_xpath('//*[@id="tel"]')
    hyarea.click()
    hyarea.clear()
    hyarea.send_keys('0830-4892927')

    # 邮箱
    hyarea = driver.find_element_by_xpath('//*[@id="mail"]')
    hyarea.click()
    hyarea.clear()
    hyarea.send_keys('*****@*****.**')

    # 授信额度
    hyarea = driver.find_element_by_xpath('//*[@id="credits"]')
    hyarea.click()
    hyarea.clear()
    hyarea.send_keys(RandomGoods.retail_price(1))

    # 备注
    hyarea = driver.find_element_by_xpath('//*[@id="comment"]')
    hyarea.click()
    hyarea.clear()
    hyarea.send_keys(nowTime() + '客户新建')

    # 点击保存
    try:
        driver.find_element_by_xpath(
            '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '//*[@id="root"]/div/div[2]/div[2]/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
        ).click()
    time.sleep(time1)
    # 抓取结果
    result_member = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    correct = ('操作成功')
    # 判断是否成功
    if result_member == correct:
        print(menber_name + ":客户新增成功\n", "客户新增功能正常\n")
    else:
        print(result_member + "\n客户新增异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")

    # 输入搜索客户
    member_search = driver.find_element_by_xpath('//*[@id="name"]')
    member_search.click()
    member_search.clear()
    member_search.send_keys(menber_name)
    time.sleep(time2)
    # 查询
    try:
        driver.find_element_by_xpath(
            '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '//*[@id="root"]/div/div[2]/div[2]/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
        ).click()
    time.sleep(2)
    # 定位搜索客户名并判断
    search_member_name = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[2]'
    ).text
    if menber_name == search_member_name:
        print(menber_name + "  等于  " + search_member_name)
        print("客户搜索功能正常\n")
    else:
        print(menber_name + "  不等于  " + search_member_name)
        print(
            "客户搜索异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        )
    time.sleep(time1)

    # 点击客户编辑
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[12]/div/a[1]/i'
    ).click()
    time.sleep(time1)
    # 保存
    try:
        driver.find_element_by_xpath(
            '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '//*[@id="root"]/div/div[2]/div[2]/div/div[3]/div/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
        ).click()
    time.sleep(time1)
    # 抓取结果
    result_member1 = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    correct = ('操作成功')
    # 判断是否成功
    if result_member1 == correct:
        print(menber_name + ":客户编辑成功\n", "客户编辑功能正常\n")
    else:
        print(result_member + "\n客户编辑异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    time.sleep(time2)

    # 输入搜索客户
    member_search = driver.find_element_by_xpath('//*[@id="name"]')
    member_search.click()
    member_search.clear()
    member_search.send_keys(menber_name)
    time.sleep(time2)
    # 查询
    try:
        driver.find_element_by_xpath(
            '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '//*[@id="root"]/div/div[2]/div[2]/div/div[3]/div/div[2]/div/div/div[1]/form/div[2]/div/button[1]'
        ).click()
    time.sleep(1)

    # 点击删除按钮
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[12]/div/a[2]/i'
    ).click()
    time.sleep(time2)
    try:
        driver.find_element_by_xpath(
            '/html/body/div[4]/div/div[2]/div/div[2]/div/div/div[2]/button[2]'
        ).click()
    except:
        driver.find_element_by_xpath(
            '/html/body/div[5]/div/div[2]/div/div[2]/div/div/div[2]/button[2]'
        ).click()
    time.sleep(0.5)
    delect = driver.find_element_by_xpath(
        '/html/body/div[2]/div/span/div/div/div/span').text
    wenzi = ('存在组绑定该客户,请解除绑定在进行作废')
    if delect == wenzi:
        print(menber_name + ":删除成功\n", "客户删除功能正常")
    else:
        print(delect + "\n客户删除异常!!!!!!!")
    time.sleep(time1)
    driver.quit()
def test6():
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)

    driver.get(url)
    # 输入账号
    name = driver.find_element_by_id('user')
    name.click()
    name.clear()
    name.send_keys(login_name)

    # 输入密码
    pwd = driver.find_element_by_id('pwd')
    pwd.click()
    pwd.clear()
    pwd.send_keys(login_pwd)

    # 登陆
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div[1]/div/div/form/div[3]/div/div/span/button'
    ).click()

    # 零售管理
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/main/div/div/button[1]').click()

    # 进入店铺
    driver.find_element_by_xpath(
        '//*[@id="root"]/div/div/section/main/div/div[2]/div/div[1]/div[2]/div/div/div/div/div/div/div/table/tbody/tr/td[2]/div/a'
    ).click()

    # 点击会员管理
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/aside/div/ul/li[3]/div[1]/span/span'
    ).click()
    print('test6:进入零售→店铺→会员管理→会员等级')
    time.sleep(time1)
    # 会员等级
    driver.find_element_by_link_text('会员等级').click()
    time.sleep(time2)

    #新增
    driver.find_element_by_link_text('新增').click()
    time.sleep(time2)
    #等级名
    hyle = driver.find_element_by_xpath('//*[@id="name"]')
    hyle.click()
    hyle.clear()
    hyle.send_keys(hyleve)
    # 积分下线
    jfxx = driver.find_element_by_xpath('//*[@id="start_score"]')
    jfxx.click()
    jfxx.clear()
    jfxx.send_keys('0')
    # 积分上线
    jfsx = driver.find_element_by_xpath('//*[@id="end_score"]')
    jfsx.click()
    jfsx.clear()
    jfsx.send_keys('0')
    # 会员折扣
    hyzk = driver.find_element_by_xpath('//*[@id="discount"]')
    hyzk.click()
    hyzk.clear()
    hyzk.send_keys('100')
    #备注
    bz = driver.find_element_by_xpath('//*[@id="comment"]')
    bz.click()
    bz.clear()
    bz.send_keys('自动创建' + nowTime())
    #保存
    driver.find_element_by_xpath(
        '//*[@class="ant-card-head-wrapper"]/div[2]/div/button[2]').click()
    print(hyleve + ':会员等级创建成功')
    print('会员等级新增功能正常\n')
    time.sleep(time2)

    # 搜索等级
    hyss = driver.find_element_by_xpath('//*[@id="name"]')
    hyss.click()
    hyss.clear()
    hyss.send_keys(hyleve)
    time.sleep(time1)
    driver.find_element_by_xpath('//*[@class="ant-row"]/div/button[1]').click()
    time.sleep(time1)

    search = driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div[2]/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[1]/a'
    ).text
    if hyleve == search:
        print(hyleve + "  等于  " + search)
        print("会员等级按等级名称搜索正常\n")
    else:
        print(hyleve + "  不等于  " + search)
        print(
            "搜索异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        )
    time.sleep(time1)
    # 点击编辑
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div[2]/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[10]/div/a[1]/i'
    ).click()
    time.sleep(time1)
    #保存
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[1]/div/div[2]/div/button[2]'
    ).click()
    print(hyleve + ":编辑成功")
    print("会员等级编辑功能正常\n")
    time.sleep(time2)

    # 搜索等级
    hyss = driver.find_element_by_xpath('//*[@id="name"]')
    hyss.click()
    hyss.clear()
    hyss.send_keys(hyleve)
    time.sleep(time1)
    driver.find_element_by_xpath('//*[@class="ant-row"]/div/button[1]').click()
    time.sleep(time1)

    #点击删除按钮
    driver.find_element_by_xpath(
        '//*[@id="root"]/section/section/main/div/div[3]/div[2]/div[2]/div/div/div[2]/div[2]/div/div/div/div[2]/div/div[2]/table/tbody/tr/td[10]/div/a[2]/i'
    ).click()
    time.sleep(time1)
    driver.find_element_by_xpath(
        '/html/body/div[4]/div/div[2]/div/div[2]/div/div/div[2]/button[2]'
    ).click()
    print(hyleve + ":删除成功")
    print("会员等级删除功能正常")
    time.sleep(time1)
    driver.quit()