Update selectors and query flow in expected/actual goods tasks
- Use regex-based locator to match 已发/已到 status options robustly - Switch to role-based selectors for 查询 button and 任务标题 column - Trigger additional 查询 after entering 数据导出 page to refresh list Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
16
main_task.py
16
main_task.py
@@ -35,13 +35,16 @@ def task_expected_goods_download(page):
|
|||||||
page.get_by_role("radio", name="1天").check()
|
page.get_by_role("radio", name="1天").check()
|
||||||
|
|
||||||
print(">> 正在展开【状态】下拉菜单...")
|
print(">> 正在展开【状态】下拉菜单...")
|
||||||
page.get_by_text("已发").click()
|
# 匹配包含 已发 或 已到 的下拉选项
|
||||||
|
page.locator(
|
||||||
|
".ant-select-selection-item", has_text=re.compile(r"已发|已到")
|
||||||
|
).click()
|
||||||
|
|
||||||
print(">> 正在选择状态为【已到】...")
|
print(">> 正在选择状态为【已到】...")
|
||||||
page.get_by_title("已到").click()
|
page.locator(".ant-select-item-option", has_text="已到").click()
|
||||||
|
|
||||||
print(">> 正在点击【查询】按钮...")
|
print(">> 正在点击【查询】按钮...")
|
||||||
page.locator("button:has-text('查询')").click()
|
page.get_by_role("button", name="search 查询").click()
|
||||||
page.wait_for_timeout(2000)
|
page.wait_for_timeout(2000)
|
||||||
|
|
||||||
# 3. 获取所有【运单列表】按钮并循环处理
|
# 3. 获取所有【运单列表】按钮并循环处理
|
||||||
@@ -83,7 +86,9 @@ def task_expected_goods_download(page):
|
|||||||
# 6. 前往数据导出页面去下载
|
# 6. 前往数据导出页面去下载
|
||||||
print(">> 正在前往【数据导出】界面...")
|
print(">> 正在前往【数据导出】界面...")
|
||||||
page.locator("a[href='/dataExport']").click()
|
page.locator("a[href='/dataExport']").click()
|
||||||
page.locator("label[title='任务标题']").wait_for(state="visible")
|
page.get_by_role("columnheader", name="任务标题").wait_for(state="visible")
|
||||||
|
page.wait_for_timeout(2000)
|
||||||
|
page.get_by_role("button", name="search 查询").click()
|
||||||
page.wait_for_timeout(2000)
|
page.wait_for_timeout(2000)
|
||||||
|
|
||||||
# 7. 轮询任务状态
|
# 7. 轮询任务状态
|
||||||
@@ -245,7 +250,8 @@ def task_actual_goods_download(page):
|
|||||||
# page.pause()
|
# page.pause()
|
||||||
page.get_by_role("columnheader", name="任务标题").wait_for(state="visible")
|
page.get_by_role("columnheader", name="任务标题").wait_for(state="visible")
|
||||||
page.wait_for_timeout(2000)
|
page.wait_for_timeout(2000)
|
||||||
|
page.get_by_role("button", name="search 查询").click()
|
||||||
|
page.wait_for_timeout(2000)
|
||||||
# 5. 轮询任务状态
|
# 5. 轮询任务状态
|
||||||
print(">> 列表中已渲染,开始匹配并检查后端处理状态...")
|
print(">> 列表中已渲染,开始匹配并检查后端处理状态...")
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user