Commit e3f3d11a authored by 章 登恒's avatar 章 登恒
Browse files

commit

parent 5be6c810
This diff is collapsed.
This diff is collapsed.
import threading
import time
from airtest.core.api import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import *
def job3():
print("这是一个需要执行的任务。。。。。")
create_salesorder(2)
print("当前线程的个数:", threading.active_count() )
time.sleep(1)
print("当前线程的信息:", threading.current_thread())
def job1():
print("这是一个需要执行的任务。。。。。")
create_salesorder1(2)
print("当前线程的个数:", threading.active_count() )
time.sleep(1)
print("当前线程的信息:", threading.current_thread())
if __name__ == "__main__":
# 创建多线程时, 需要制定该线程执行的任务.name线程名字 target目标函数名
from testcase.od.库存预占边界测试.销售订单1 import *
from testcase.od.库存预占边界测试.调拨出库单1 import *
# t1 = threading.Thread(target=create_salesorder,name="job1")
# t2 = threading.Thread(target=create_salesorder1,name="job2")
# t1.start()
# t2.start()
count = 4 #4个人下单,只有3个商品
# semaphore = threading.Semaphore(value=1)
for i in range(count):
if i<2:
t = threading.Thread(target=job3)
t.start()
if i>=2:
t = threading.Thread(target=job1)
t.start()
# t.join()
print(threading.active_count())
# sleep(30)
# sys.exit(0)
# print("程序执行结束.....")
# for i in range(10):
# from testcase.od.销售订单 import *
# start1()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import datetime
import threading
import time
import traceback
from airtest.core.api import *
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import *
from selenium.webdriver import Chrome, ChromeOptions
from airtest.core.api import *
from airtest_selenium.proxy import *
from public.mail1 import send_email1
from public.tools import *
opt = ChromeOptions() # 创建 Chrome 参数对象
opt.headless = False # 把 Chrome 设置成无界面模式,windows/Linux 皆可
opt.add_argument('--start-maximized')
opt.add_argument('--window-size=1280x1024')
chrome = webdriver.Chrome(chrome_options=opt)
SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址
#通行证
usr1,pwd1 = 'bj_01','Gyxc1234'
usr2,pwd2 = 'bj_02','Gyxc1234'
usr3,pwd3 = 'bj_03','Gyxc1234'
usr4,pwd4 = 'bj_04','Gyxc1234'
usr5,pwd5 = 'bj_05','Gyxc1234'
warehousename = '北京强生非WMS仓'#仓库名称
class LoginSys():
def loginsys(self,url,usr,pwd):
chrome.get(url)
sleep(2)
chrome.find_element_by_id('input1').clear()
chrome.find_element_by_id('input1').send_keys(usr)
chrome.find_element_by_id('input2').clear()
chrome.find_element_by_id('input2').send_keys(pwd)
chrome.find_element_by_id('input2').send_keys(Keys.ENTER)
while True:
try:
if(chrome.find_element_by_xpath('//span[text()="退出"]').is_displayed()==True):
break
except:
continue
class PurchaseOrder():
def data_add(self):
order_link = chrome.find_element_by_xpath('//span[text()="普通采购订单"]')
chrome.execute_script("arguments[0].click();", order_link)
chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]'))
sleep(2)
chrome.find_element_by_xpath('//span[text()="新建"]').click()
sleep(4)
chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
sleep(2)
# 获取订单号
orderno = chrome.find_element_by_xpath('//div[text() = "订单号 "]/following-sibling::div/span').text
print(orderno)
#填写仓库信息
chrome.find_element_by_xpath('//div[text()="仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
sleep(1)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:仓库名称,仓库编码"]').send_keys(warehousename)
chrome.find_element_by_xpath('//input[@placeholder="模糊检索:仓库名称,仓库编码"]').send_keys(Keys.ENTER)
sleep(1)
btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="022bc5d182335c5146b3817a500c2cbc7"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click()
sleep(1)
#填写合同信息
chrome.find_element_by_xpath('//div[text()="合同信息"]').click()
chrome.find_element_by_xpath(
'//div[text()="合同号 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同号,合同协议号,对方编码,项目名称,项目编码,业态编码,参考部门,参考部门编码,参考业务员,参考业务员编码,产品线名称,产品线编码,合同类型,合同属性"]').send_keys(
'38443')
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同号,合同协议号,对方编码,项目名称,项目编码,业态编码,参考部门,参考部门编码,参考业务员,参考业务员编码,产品线名称,产品线编码,合同类型,合同属性"]').send_keys(
Keys.ENTER)
chrome.find_element_by_xpath(
'//div[@class="multiple-header string_col" and text()="38443"]/ancestor-or-self::td/preceding-sibling::td/div/label/span/span').click()
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[3]').click()
sleep(2)
if __name__ == '__main__':
step1 = LoginSys()
step2 = PurchaseOrder()
step1.loginsys(SIT_URL,usr2,pwd2)
step2.data_add()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment