AutoRpa/codes/rpa_yisaiqi/yisaiqi_adapter_template.py

67 lines
3.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""YiSaiQi adapter template for CONTRACT_CREATE flowchart nodes.
This file is a mapping template. In the YiSaiQi designer, replace each method
body with the platform's native browser activities: open webpage, input text,
click element, select dropdown, upload file, read text, and screenshot.
"""
from __future__ import annotations
class YiSaiQiBrowserAdapter:
def open_url(self, url: str) -> None:
"""Flowchart node: 浏览器打开网页."""
raise NotImplementedError("Map to YiSaiQi browser open-url activity")
def fill_first(self, selectors: list[str], value: str) -> None:
"""Flowchart node: 按候选定位器依次查找,找到后输入文本."""
raise NotImplementedError(f"Map to YiSaiQi input-text activity: {selectors=} {value=}")
def click_first(self, selectors: list[str]) -> None:
"""Flowchart node: 按候选定位器依次查找,找到后点击."""
raise NotImplementedError(f"Map to YiSaiQi click activity: {selectors=}")
def double_click_first(self, selectors: list[str]) -> None:
"""Flowchart node: 双击元素(客商选择窗口等)."""
raise NotImplementedError(f"Map to YiSaiQi double-click activity: {selectors=}")
def wait_for_text(self, text: str, timeout_seconds: int = 15) -> None:
"""Flowchart node: 等待页面出现指定文本."""
raise NotImplementedError(f"Map to YiSaiQi wait-text activity: {text=} {timeout_seconds=}")
def wait_for_element(self, selectors: list[str], timeout_seconds: int = 15) -> None:
"""Flowchart node: 等待元素出现."""
raise NotImplementedError(f"Map to YiSaiQi wait-element activity: {selectors=}")
def element_exists(self, selectors: list[str]) -> bool:
"""Flowchart node: 判断元素是否存在."""
raise NotImplementedError(f"Map to YiSaiQi element-exists activity: {selectors=}")
def switch_to_frame(self, selectors: list[str]) -> None:
"""Flowchart node: 切换到 iframe(客商选择弹窗等)."""
raise NotImplementedError(f"Map to YiSaiQi switch-to-frame activity: {selectors=}")
def switch_to_default_content(self) -> None:
"""Flowchart node: 切回主文档."""
raise NotImplementedError("Map to YiSaiQi switch-to-default-content activity")
def read_body_text(self) -> str:
"""Flowchart node: 读取页面 body 文本."""
raise NotImplementedError("Map to YiSaiQi read-body-text activity")
def select_first(self, selectors: list[str], value: str) -> None:
"""Flowchart node: 下拉框选择."""
raise NotImplementedError(f"Map to YiSaiQi select activity: {selectors=} {value=}")
def upload_file_first(self, selectors: list[str], file_path: str) -> None:
"""Flowchart node: 文件上传."""
raise NotImplementedError(f"Map to YiSaiQi upload-file activity: {selectors=} {file_path=}")
def read_first(self, selectors: list[str], value_name: str) -> str:
"""Flowchart node: 读取页面文本/输入框值并写入流程变量."""
raise NotImplementedError(f"Map to YiSaiQi read-text activity: {selectors=} {value_name=}")
def screenshot(self, name: str) -> str:
"""Flowchart node: 截图存证,返回文件路径."""
raise NotImplementedError(f"Map to YiSaiQi screenshot activity: {name=}")