feat: 添加测试方法以验证DailymotionClient功能并记录截图

This commit is contained in:
晓丰 2025-06-27 18:45:15 +08:00
parent 85fce7eadd
commit bb9830887a

View File

@ -319,20 +319,34 @@ class DailymotionClient:
# 处理 Solved 状态 # 处理 Solved 状态
return 2,"" return 2,""
@require_login
def test(self):
logger.info(f"Testing DailymotionClient with email: {self.email}")
self.page.goto(self.url, timeout=30000)
file_path = f'screenshots/{str(int(time.time()))}_test.png'
self.page.screenshot(path=file_path)
self.page.wait_for_timeout(1000)
file_path = f"screenshots/{str(int(time.time()))}_test2.png"
self.page.screenshot(path=file_path)
logger.info(f"Test screenshot saved to {file_path}")
self.page.wait_for_timeout(1000)
file_path = f"screenshots/{str(int(time.time()))}_test3.png"
self.page.screenshot(path=file_path)
logger.info(f"Test screenshot saved to {file_path}")
def close(self): def close(self):
try: try:
self.page.close() self.page.close()
except Exception: except Exception:
pass pass
try: try:
self.browser.close() self.browser.close()
except Exception: except Exception:
pass pass
try: try:
self._pw.stop() self._pw.stop()
except Exception: except Exception:
pass pass
if __name__ == "__main__": if __name__ == "__main__":