(self, action_seq: str | list[str])
| 103 | |
| 104 | @beartype |
| 105 | def set_actions(self, action_seq: str | list[str]) -> None: |
| 106 | if isinstance(action_seq, str): |
| 107 | action_strs = action_seq.strip().split("\n") |
| 108 | else: |
| 109 | action_strs = action_seq |
| 110 | action_strs = [a.strip() for a in action_strs] |
| 111 | |
| 112 | actions = [] |
| 113 | for a_str in action_strs: |
| 114 | try: |
| 115 | if self.action_set_tag == "playwright": |
| 116 | cur_action = create_playwright_action(a_str) |
| 117 | elif self.action_set_tag == "id_accessibility_tree": |
| 118 | cur_action = create_id_based_action(a_str) |
| 119 | else: |
| 120 | raise ValueError( |
| 121 | f"Unknown action type {self.action_set_tag}" |
| 122 | ) |
| 123 | except ActionParsingError as e: |
| 124 | cur_action = create_none_action() |
| 125 | |
| 126 | cur_action["raw_prediction"] = a_str |
| 127 | actions.append(cur_action) |
| 128 | |
| 129 | self.actions: list[Action] = actions |
| 130 | |
| 131 | @beartype |
| 132 | def next_action( |
no test coverage detected