import time from selenium import webdriver from tool.loginFile.login import Login from tool.random.randomMember import RandomMember 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) login_name = Login.name(1) login_pwd = Login.password(1) time1 = LoadTime.time1(1) time2 = LoadTime.time2(1) time3 = LoadTime.time3(1) manufacturer = RandomSupplier.manufacturer_name(1) phone = RandomPhone.phone(1) # 厂商信息 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)
def test124(): driver = webdriver.Chrome() driver.maximize_window() driver.implicitly_wait(10) driver.get(Login.location(1)) # 输入账号 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() # driver.find_element_by_class_name('ant-btn ant-btn-primary') # 批发管理 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[1]/td[2]/div/a' ).click() time.sleep(time1) # 点击批发管理 driver.find_element_by_xpath( '//*[@id="root"]/section/section/aside/div/ul/li[9]/div[1]/span/span' ).click() print('test124:进入批发→组→批发管理→批发退货') time.sleep(time1) # 批发退货 driver.find_element_by_link_text('批发退货').click() time.sleep(time2) driver.find_element_by_link_text('新增').click() time.sleep(time2) # 订货客户 driver.find_element_by_xpath('//*[@id="client_id"]/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(time2) # 选择仓库 driver.find_element_by_xpath( '//*[@id="warehouse_id"]/div/div/div[1]').click() time.sleep(time1) driver.find_element_by_xpath('/html/body/div[4]/div/div//ul/li[1]').click() time.sleep(time1) # 业务员 driver.find_element_by_xpath('//*[@id="salesId"]/div/div').click() time.sleep(time1) driver.find_element_by_xpath('/html/body/div[5]/div/div//ul/li[%s]' % random_number).click() time.sleep(time2) # 业务费用 zfhk = driver.find_element_by_xpath('//*[@id="costs"]') zfhk.click() zfhk.clear() zfhk.send_keys(money) # 费用备注 fybz = driver.find_element_by_xpath('//*[@id="costs_comment"]') fybz.click() fybz.clear() fybz.send_keys('费用说明' + tim) # 本次收款 fybz = driver.find_element_by_xpath('//*[@id="payment_amount"]') fybz.click() fybz.clear() fybz.send_keys(money) # 支付方式 driver.find_element_by_xpath( '//*[@id="payment_method"]/div/div/div[1]').click() time.sleep(time2) driver.find_element_by_xpath('/html/body/div[6]/div/div//ul/li[1]').click() # 批发备注 djbz = driver.find_element_by_xpath('//*[@id="comment"]') djbz.click() djbz.clear() djbz.send_keys('批发' + tim) # 点击添加商品框输入搜索数字 srsp = driver.find_element_by_xpath( '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div[2]/div[1]/div/div[2]/div/span/div/div/div/ul/li/div/input' ) srsp.click() srsp.clear() srsp.send_keys(import_number) time.sleep(time1) # 选择搜索出来的第一个商品 driver.find_element_by_xpath('/html/body/div[7]/div/div//ul/li[1]').click() time.sleep(time1) # 定位数量输入框 input_number = driver.find_element_by_xpath( '/html/body/div[8]/div/div[2]/div/div[2]/div[2]/div[1]/div/div/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div[2]/div' ) # 鼠标双击选择 ActionChains(driver).double_click(input_number).perform() time.sleep(time2) # 输入数量 driver.find_element_by_xpath( '/html/body/div[8]/div/div[2]/div/div[2]/div[2]/div[1]/div/div/div[2]/div/div/div/div/div[2]/div/div/div[1]/div/input' ).send_keys(random_number) # 确定 driver.find_element_by_xpath( '/html/body/div[8]/div/div[2]/div/div[2]/div[3]/button[2]').click() time.sleep(time1) # 获取进货商品名字 shop_name = driver.find_element_by_xpath( '//*[@id="root"]/section/section/main/div/div[3]/div/div[2]/div/div/div[2]/div[2]/div[3]/div/div/div/div[2]/div/div/div[2]/div/div[3]/div/div/span' ).text # 保存 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() print(shop_name + ':批发订单' + '1件下单成功', '\n批发订单下单正常\n') time.sleep(time1) # 抓取结果 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 = zi in result_savel # 判断是否成功 if resul == True: print(result_savel + "\n批发审核异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") elif resull == True: print(result_savel + "\n批发审核异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") # 取消打印 try: driver.find_element_by_xpath( '/html/body/div[11]/div/div[2]/div/div[2]/div/div/div[2]/button[1]' ).click() except: driver.find_element_by_xpath( '/html/body/div[10]/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[2]/div/div/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[13]/div/a[1]/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_save = driver.find_element_by_xpath( '/html/body/div[2]/div/span/div/div/div/span').text correct = ('操作成功') # 判断是否成功 if result_save == correct: print(shop_name + ":批发审核成功\n", "批发审核正常\n") else: print(result_save + "\n批发审核异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") # 提交发货 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[13]/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[6]/div/div[2]/div/div[2]/div/div/div[2]/button[2]' ).click() # 抓取结果 result_save1 = driver.find_element_by_xpath( '/html/body/div[2]/div/span/div/div/div/span').text correct = ('操作成功') # 判断是否成功 if result_save1 == correct: print(shop_name + ":批发发货成功\n", "批发发货正常\n") else: print(result_save1 + "\n批发发货异常!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") 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()
import time from selenium import webdriver from tool.random.randomGoods import RandomGoods from tool.time.loadingTime import LoadTime from tool.loginFile.login import Login url = Login.location(1) addname = Login.name(1) addpwd = Login.password(1) #商品款号 goods_number = RandomGoods.goods_number(1) #商品名称 goodname = RandomGoods.goods_name(1) # 指导定价 price = RandomGoods.price(1) # 零售价 retail = RandomGoods.retail_price(1) time1 = LoadTime.time1(1) time2 = LoadTime.time2(1) time3 = LoadTime.time3(1) # 库存信息 def test10(): try: # r"D:\Python36-32\chromedriver.exe" driver = webdriver.Chrome() driver.maximize_window() driver.implicitly_wait(10) driver.get(url)
import time from selenium import webdriver from tool.random.randomGoods import RandomGoods from tool.loginFile.login import Login from tool.random.randomMember import RandomMember from tool.random.randomPerson import RandomStaff from tool.random.randomPhone import RandomPhone from tool.time.loadingTime import LoadTime from tool.time.nowTime import nowTime url = Login.location(1) menber_name = RandomMember.member_name(1) time1 = LoadTime.time1(1) time2 = LoadTime.time2(1) time3 = LoadTime.time3(1) # 客户信息 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)) # 输入密码