main
HuangHai 5 months ago
parent 43afdb161b
commit 98e9302f7e

@ -286,17 +286,17 @@ def paiCheng(page, keyword, stHour, stMin, stSec, endHour, endMin, endSec):
span_handle = spans.nth(index).element_handle()
span_handle.evaluate("element => element.click()")
break
# 等待
# 定位目标 <input> 元素
# 等待动态页面加载完成
wait(2)
# 输入开始时间
input_element = page.locator("input#mat-input-3") # 通过 id 定位
input_element.wait_for(state="visible", timeout=5000) # 等待元素可见,最多 5 秒
input_element.click()
# 定位目标 <input> 元素
hour_input = page.locator("input.owl-dt-timer-input").nth(0) # 第一个输入框(小时)
minute_input = page.locator("input.owl-dt-timer-input").nth(1) # 第二个输入框(分钟)
second_input = page.locator("input.owl-dt-timer-input").nth(2) # 第三个输入框(秒)
wait()
# 输入时间
hour_input.fill(stHour) # 输入小时
wait()
@ -304,24 +304,19 @@ def paiCheng(page, keyword, stHour, stMin, stSec, endHour, endMin, endSec):
wait()
second_input.fill(stSec) # 输入秒
wait()
# 定位 <button> 元素
# 设定
set_button = page.locator("button.owl-dt-control-button", has_text="Set")
set_button.click()
wait()
wait(2)
# 定位目标 <input> 元素
#========================================== 输入结束时间==========================================
time_input = page.locator("input#mat-input-4") # 通过 id 定位
# 点击 <input> 元素
time_input.click()
wait()
hour_input = page.locator("input.owl-dt-timer-input").nth(0) # 第一个输入框(小时)
wait()
minute_input = page.locator("input.owl-dt-timer-input").nth(1) # 第二个输入框(分钟)
wait()
second_input = page.locator("input.owl-dt-timer-input").nth(2) # 第三个输入框(秒)
wait()
# 输入时间
hour_input.fill(endHour) # 输入小时
@ -330,6 +325,7 @@ def paiCheng(page, keyword, stHour, stMin, stSec, endHour, endMin, endSec):
wait()
second_input.fill(endSec) # 输入秒
wait()
# 定位 <button> 元素
set_button = page.locator("button.owl-dt-control-button", has_text="Set")
set_button.click()
@ -340,6 +336,7 @@ def paiCheng(page, keyword, stHour, stMin, stSec, endHour, endMin, endSec):
# 点击 <span> 元素
confirm_span.click()
wait()
# 定位目标 <span> 元素
apply_span = page.locator("span", has_text="应用").nth(0)
apply_span.click()
@ -356,23 +353,23 @@ def run(playwright: Playwright) -> None:
# 登录
login(page)
# 只删除固定前缀的节目
# # 只删除固定前缀的节目
delProgram(page, PREFIX_NAME)
#
# 删除素材
delMaterial(page)
# 上传文件
#uploadVideo(page, VIDEO_PATH)
uploadVideo(page, VIDEO_PATH)
# 发布节目
#publish(page, 'Test1', str(1280), str(720))
publish(page, 'Test1', str(1280), str(720))
# 切换到节目
#changeJieMu(page)
changeJieMu(page)
# 排程
#paiCheng(page, PREFIX_NAME, '12', '00', '00', '13', '00', '00')
paiCheng(page, PREFIX_NAME, '12', '00', '00', '13', '00', '00')
time.sleep(100)

Loading…
Cancel
Save