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:
22
main_task.py
22
main_task.py
@@ -35,13 +35,16 @@ def task_expected_goods_download(page):
|
||||
page.get_by_role("radio", name="1天").check()
|
||||
|
||||
print(">> 正在展开【状态】下拉菜单...")
|
||||
page.get_by_text("已发").click()
|
||||
# 匹配包含 已发 或 已到 的下拉选项
|
||||
page.locator(
|
||||
".ant-select-selection-item", has_text=re.compile(r"已发|已到")
|
||||
).click()
|
||||
|
||||
print(">> 正在选择状态为【已到】...")
|
||||
page.get_by_title("已到").click()
|
||||
page.locator(".ant-select-item-option", has_text="已到").click()
|
||||
|
||||
print(">> 正在点击【查询】按钮...")
|
||||
page.locator("button:has-text('查询')").click()
|
||||
page.get_by_role("button", name="search 查询").click()
|
||||
page.wait_for_timeout(2000)
|
||||
|
||||
# 3. 获取所有【运单列表】按钮并循环处理
|
||||
@@ -83,7 +86,9 @@ def task_expected_goods_download(page):
|
||||
# 6. 前往数据导出页面去下载
|
||||
print(">> 正在前往【数据导出】界面...")
|
||||
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)
|
||||
|
||||
# 7. 轮询任务状态
|
||||
@@ -209,13 +214,13 @@ def task_actual_goods_download(page):
|
||||
page.locator("div.ant-pro-menu-item:has-text('卸车扫描记录')").click()
|
||||
|
||||
page.get_by_role("radio", name="1天").wait_for(state="visible")
|
||||
#page.locator("button:has-text('查询')").wait_for(state="visible")
|
||||
# page.locator("button:has-text('查询')").wait_for(state="visible")
|
||||
print("✅ 卸车扫描记录界面加载完毕")
|
||||
|
||||
# 2. 筛选条件:1天、查询
|
||||
print(">> 正在设置筛选条件: 选择【1天】...")
|
||||
page.get_by_role("radio", name="1天").check()
|
||||
#page.pause()
|
||||
# page.pause()
|
||||
print(">> 正在点击【查询】按钮...")
|
||||
page.get_by_role("button", name="search 查询").click()
|
||||
page.wait_for_timeout(2000)
|
||||
@@ -242,10 +247,11 @@ def task_actual_goods_download(page):
|
||||
# 4. 前往数据导出页面去下载
|
||||
print(">> 正在前往【数据导出】界面...")
|
||||
page.locator("a[href='/dataExport']").click()
|
||||
#page.pause()
|
||||
# page.pause()
|
||||
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)
|
||||
# 5. 轮询任务状态
|
||||
print(">> 列表中已渲染,开始匹配并检查后端处理状态...")
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user