Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/core/prompts/__tests__/__snapshots__/system.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2714,6 +2714,9 @@ Parameters:
* launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**.
- Use with the \`url\` parameter to provide the URL.
- Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)
* hover: Move the cursor to a specific x,y coordinate.
- Use with the \`coordinate\` parameter to specify the location.
- Always move to the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
* click: Click at a specific x,y coordinate.
- Use with the \`coordinate\` parameter to specify the location.
- Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
Expand All @@ -2725,7 +2728,7 @@ Parameters:
- Example: \`<action>close</action>\`
- url: (optional) Use this for providing the URL for the \`launch\` action.
* Example: <url>https://example.com</url>
- coordinate: (optional) The X and Y coordinates for the \`click\` action. Coordinates should be within the **900x600** resolution.
- coordinate: (optional) The X and Y coordinates for the \`click\` and \`hover\` actions. Coordinates should be within the **900x600** resolution.
* Example: <coordinate>450,300</coordinate>
- text: (optional) Use this for providing the text for the \`type\` action.
* Example: <text>Hello, world!</text>
Expand Down Expand Up @@ -3625,6 +3628,9 @@ Parameters:
* launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**.
- Use with the \`url\` parameter to provide the URL.
- Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)
* hover: Move the cursor to a specific x,y coordinate.
- Use with the \`coordinate\` parameter to specify the location.
- Always move to the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
* click: Click at a specific x,y coordinate.
- Use with the \`coordinate\` parameter to specify the location.
- Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
Expand All @@ -3636,7 +3642,7 @@ Parameters:
- Example: \`<action>close</action>\`
- url: (optional) Use this for providing the URL for the \`launch\` action.
* Example: <url>https://example.com</url>
- coordinate: (optional) The X and Y coordinates for the \`click\` action. Coordinates should be within the **1280x800** resolution.
- coordinate: (optional) The X and Y coordinates for the \`click\` and \`hover\` actions. Coordinates should be within the **1280x800** resolution.
* Example: <coordinate>450,300</coordinate>
- text: (optional) Use this for providing the text for the \`type\` action.
* Example: <text>Hello, world!</text>
Expand Down
5 changes: 4 additions & 1 deletion src/core/prompts/tools/browser-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Parameters:
* launch: Launch a new Puppeteer-controlled browser instance at the specified URL. This **must always be the first action**.
- Use with the \`url\` parameter to provide the URL.
- Ensure the URL is valid and includes the appropriate protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)
* hover: Move the cursor to a specific x,y coordinate.
- Use with the \`coordinate\` parameter to specify the location.
- Always move to the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
* click: Click at a specific x,y coordinate.
- Use with the \`coordinate\` parameter to specify the location.
- Always click in the center of an element (icon, button, link, etc.) based on coordinates derived from a screenshot.
Expand All @@ -26,7 +29,7 @@ Parameters:
- Example: \`<action>close</action>\`
- url: (optional) Use this for providing the URL for the \`launch\` action.
* Example: <url>https://example.com</url>
- coordinate: (optional) The X and Y coordinates for the \`click\` action. Coordinates should be within the **${args.browserViewportSize}** resolution.
- coordinate: (optional) The X and Y coordinates for the \`click\` and \`hover\` actions. Coordinates should be within the **${args.browserViewportSize}** resolution.
* Example: <coordinate>450,300</coordinate>
- text: (optional) Use this for providing the text for the \`type\` action.
* Example: <text>Hello, world!</text>
Expand Down
6 changes: 5 additions & 1 deletion src/core/tools/browserActionTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function browserActionTool(
await cline.browserSession.launchBrowser()
browserActionResult = await cline.browserSession.navigateToUrl(url)
} else {
if (action === "click") {
if (action === "click" || action === "hover") {
if (!coordinate) {
cline.consecutiveMistakeCount++
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "coordinate"))
Expand Down Expand Up @@ -103,6 +103,9 @@ export async function browserActionTool(
case "click":
browserActionResult = await cline.browserSession.click(coordinate!)
break
case "hover":
browserActionResult = await cline.browserSession.hover(coordinate!)
break
case "type":
browserActionResult = await cline.browserSession.type(text!)
break
Expand All @@ -121,6 +124,7 @@ export async function browserActionTool(
switch (action) {
case "launch":
case "click":
case "hover":
case "type":
case "scroll_down":
case "scroll_up":
Expand Down