|
|
|
@ -227,12 +227,18 @@ def changeJieMu(page):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 排程
|
|
|
|
|
def paiCheng(page, keyword):
|
|
|
|
|
def paiCheng(page, keyword, stHour, stMin, stSec, endHour, endMin, endSec):
|
|
|
|
|
pc_library = page.get_by_text("排程").nth(0)
|
|
|
|
|
pc_library.click()
|
|
|
|
|
|
|
|
|
|
# 等待
|
|
|
|
|
wait()
|
|
|
|
|
# 定位目标 <span> 元素
|
|
|
|
|
today_span = page.locator("span.mat-button-toggle-label-content", has_text="日")
|
|
|
|
|
today_span.click()
|
|
|
|
|
# 等待
|
|
|
|
|
wait()
|
|
|
|
|
|
|
|
|
|
# 定位目标 <mat-icon> 元素
|
|
|
|
|
add_icon = page.locator("mat-icon", has_text="add").nth(1)
|
|
|
|
|
|
|
|
|
@ -295,9 +301,9 @@ def paiCheng(page, keyword):
|
|
|
|
|
minute_input = page.locator("input.owl-dt-timer-input").nth(1) # 第二个输入框(分钟)
|
|
|
|
|
second_input = page.locator("input.owl-dt-timer-input").nth(2) # 第三个输入框(秒)
|
|
|
|
|
# 输入时间
|
|
|
|
|
hour_input.fill("12") # 输入小时
|
|
|
|
|
minute_input.fill("00") # 输入分钟
|
|
|
|
|
second_input.fill("00") # 输入秒
|
|
|
|
|
hour_input.fill(stHour) # 输入小时
|
|
|
|
|
minute_input.fill(stMin) # 输入分钟
|
|
|
|
|
second_input.fill(stSec) # 输入秒
|
|
|
|
|
|
|
|
|
|
# 等待
|
|
|
|
|
wait()
|
|
|
|
@ -316,9 +322,9 @@ def paiCheng(page, keyword):
|
|
|
|
|
minute_input = page.locator("input.owl-dt-timer-input").nth(1) # 第二个输入框(分钟)
|
|
|
|
|
second_input = page.locator("input.owl-dt-timer-input").nth(2) # 第三个输入框(秒)
|
|
|
|
|
# 输入时间
|
|
|
|
|
hour_input.fill("13") # 输入小时
|
|
|
|
|
minute_input.fill("01") # 输入分钟
|
|
|
|
|
second_input.fill("00") # 输入秒
|
|
|
|
|
hour_input.fill(endHour) # 输入小时
|
|
|
|
|
minute_input.fill(endMin) # 输入分钟
|
|
|
|
|
second_input.fill(endSec) # 输入秒
|
|
|
|
|
# 定位 <button> 元素
|
|
|
|
|
set_button = page.locator("button.owl-dt-control-button", has_text="Set")
|
|
|
|
|
set_button.click()
|
|
|
|
@ -326,11 +332,10 @@ def paiCheng(page, keyword):
|
|
|
|
|
# 定位目标 <span> 元素
|
|
|
|
|
confirm_span = page.locator("span.mat-button-wrapper", has_text="确认")
|
|
|
|
|
# 点击 <span> 元素
|
|
|
|
|
if confirm_span.count() > 0: # 确保元素存在
|
|
|
|
|
confirm_span.click()
|
|
|
|
|
print("Clicked on the confirm button.")
|
|
|
|
|
else:
|
|
|
|
|
print("Confirm button not found.")
|
|
|
|
|
confirm_span.click()
|
|
|
|
|
# 定位目标 <span> 元素
|
|
|
|
|
apply_span = page.locator("span", has_text="应用").nth(0)
|
|
|
|
|
apply_span.click()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(playwright: Playwright) -> None:
|
|
|
|
@ -344,22 +349,22 @@ def run(playwright: Playwright) -> None:
|
|
|
|
|
login(page)
|
|
|
|
|
|
|
|
|
|
# 只删除固定前缀的节目
|
|
|
|
|
# delProgram(page, PREFIX_NAME)
|
|
|
|
|
delProgram(page, PREFIX_NAME)
|
|
|
|
|
|
|
|
|
|
# 删除素材
|
|
|
|
|
# delMaterial(page)
|
|
|
|
|
delMaterial(page)
|
|
|
|
|
|
|
|
|
|
# 上传文件
|
|
|
|
|
# uploadVideo(page, VIDEO_PATH)
|
|
|
|
|
uploadVideo(page, VIDEO_PATH)
|
|
|
|
|
|
|
|
|
|
# 发布节目
|
|
|
|
|
# publish(page)
|
|
|
|
|
publish(page)
|
|
|
|
|
|
|
|
|
|
# 切换到节目
|
|
|
|
|
# changeJieMu(page)
|
|
|
|
|
changeJieMu(page)
|
|
|
|
|
|
|
|
|
|
# 排程
|
|
|
|
|
paiCheng(page, PREFIX_NAME)
|
|
|
|
|
paiCheng(page, PREFIX_NAME, '12', '00', '00', '13', '00', '00')
|
|
|
|
|
|
|
|
|
|
time.sleep(100)
|
|
|
|
|
|
|
|
|
|