Skip to content

Commit 69740e8

Browse files
authored
Merge pull request #168 from endsock/addpic
处理acknowledgement浮层问题
2 parents 153c200 + 7a51f11 commit 69740e8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

browser_utils/page_controller.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ async def submit_prompt(self, prompt: str,image_list: List, check_client_disconn
479479
# 当文件选择器出现时,它会得到 FileChooser 对象
480480
function_btn_localtor = self.page.locator('button[aria-label="Insert assets such as images, videos, files, or audio"]')
481481
await function_btn_localtor.click()
482-
asyncio.sleep(0.5)
482+
#asyncio.sleep(0.5)
483483
async with self.page.expect_file_chooser() as fc_info:
484484
# 2. 点击那个会触发文件选择的普通按钮
485485
upload_btn_localtor = self.page.locator(UPLOAD_BUTTON_SELECTOR)
@@ -494,6 +494,11 @@ async def submit_prompt(self, prompt: str,image_list: List, check_client_disconn
494494
await file_chooser.set_files(image_list)
495495
print(f"已将 '{image_list}' 设置到文件选择器。")
496496

497+
#asyncio.sleep(0.2)
498+
acknow_btn_locator = self.page.locator('button[aria-label="Agree to the copyright acknowledgement"]')
499+
if await acknow_btn_locator.count() > 0:
500+
await acknow_btn_locator.click()
501+
497502
except Exception as e:
498503
print(f"在上传文件时发生错误: {e}")
499504

0 commit comments

Comments
 (0)