You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: webqa_agent/llm/prompt.py
+3-72Lines changed: 3 additions & 72 deletions
Original file line number
Diff line number
Diff line change
@@ -83,44 +83,13 @@ class LLMPrompt:
83
83
- All plans must reflect actual context in screenshot.
84
84
- Always output strict **valid JSON**. No comments or markdown.
85
85
86
-
## Navigation Strategy Guidelines (CRITICAL)
87
-
88
-
### Action Selection Priority for Navigation
89
-
When planning navigation actions, follow this STRICT priority order:
90
-
91
-
1. **GoToPage (HIGHEST RELIABILITY - PREFERRED)**
92
-
- Use when: Target URL is known or can be determined
93
-
- Best for: Returning to original tabs/pages, switching between known pages, going to homepage
94
-
- Reliability: 100% - Direct URL manipulation, no UI dependency
95
-
- Example: Returning to original tab with known URL
96
-
97
-
2. **GoBack (HIGH RELIABILITY)**
98
-
- Use when: Browser history navigation is appropriate
99
-
- Best for: Sequential backward navigation
100
-
- Reliability: 95% - Browser-native functionality
101
-
- Example: Returning to previous form after submission
102
-
103
-
3. **Tap/Click (LOWER RELIABILITY - USE WITH CAUTION)**
104
-
- Use when: Target URL is unknown AND element interaction is required
105
-
- Best for: Discovering new pages, triggering dynamic content
106
-
- Reliability: 60-80% - Depends on element state, page load, icon behavior
107
-
- Example: Clicking unexplored menu items
108
-
109
-
### Critical Decision Rule
110
-
**IF you know the target URL → ALWAYS use GoToPage over Tap**
111
-
- This includes: returning to original tab, going to homepage, switching between tabs
112
-
- Rationale: URL navigation is deterministic, UI element clicks are probabilistic
113
-
114
86
## Actions
115
87
116
88
Each action includes `type` and `param`, optionally with `locate`.
117
89
118
90
Each action has a
119
-
- type: 'Tap', tap the located element [USE ONLY WHEN URL UNKNOWN]
91
+
- type: 'Tap', tap the located element
120
92
* {{ locate: {{ id: string }}, param: null }}
121
-
* WARNING: Less reliable for navigation - UI elements may fail or behave inconsistently
122
-
* Use ONLY when: target URL is unknown AND you need to discover new pages
123
-
* Do NOT use for: returning to known pages, switching tabs when URLs are available
124
93
- type: 'Hover', move mouse over to the located element
125
94
* {{ locate: {{ id: string }}, param: null }}
126
95
- type: 'Input', replace the value in the input field
@@ -147,12 +116,9 @@ class LLMPrompt:
147
116
- type: 'GetNewPage', get the new page
148
117
* {{ param: null }}
149
118
* use this action when the instruction is a "get new page" statement or "open in new tab" or "open in new window".
150
-
- type: 'GoToPage', navigate directly to a specific URL [PREFERRED FOR RELIABLE NAVIGATION]
119
+
- type: 'GoToPage', navigate directly to a specific URL
151
120
* {{ param: {{ url: string }} }}
152
-
* CRITICAL: This is the MOST RELIABLE navigation method - use whenever target URL is known
153
-
* PREFERRED for: returning to original tab/page, switching between known pages, going to homepage
154
-
* AVOID clicking UI elements (logos, icons) for navigation when URL is available
155
-
* Example: To return to original tab, use GoToPage with the original URL instead of clicking browser tabs or page icons
121
+
* use this action when you need to navigate to a specific web page URL, useful for returning to homepage or navigating to known pages.
156
122
- type: 'GoBack', navigate back to the previous page
157
123
* {{ param: null }}
158
124
* use this action when you need to go back to the previous page in the browser history, similar to clicking the browser's back button.
@@ -446,41 +412,6 @@ class LLMPrompt:
446
412
}
447
413
```
448
414
449
-
#### Example 8: Return to Original Tab/Page (CRITICAL PATTERN)
450
-
"Return to the original tab/page where we started"
451
-
```json
452
-
{
453
-
"actions": [
454
-
{
455
-
"type": "GoToPage",
456
-
"thought": "Using GoToPage for guaranteed navigation back to original URL. This is more reliable than clicking UI elements which may fail or behave unpredictably.",
0 commit comments