Revert "Don't interact with fields that are already filled in" (#182)
This commit is contained in:
@@ -604,7 +604,6 @@ class ForgeAgent(Agent):
|
|||||||
for window_step in window_steps:
|
for window_step in window_steps:
|
||||||
if window_step.output and window_step.output.action_results:
|
if window_step.output and window_step.output.action_results:
|
||||||
action_results.extend(window_step.output.action_results)
|
action_results.extend(window_step.output.action_results)
|
||||||
|
|
||||||
action_results_str = json.dumps([action_result.model_dump() for action_result in action_results])
|
action_results_str = json.dumps([action_result.model_dump() for action_result in action_results])
|
||||||
# Generate the extract action prompt
|
# Generate the extract action prompt
|
||||||
navigation_goal = task.navigation_goal
|
navigation_goal = task.navigation_goal
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ class TaskBlock(Block):
|
|||||||
raise TaskNotFound(task.task_id)
|
raise TaskNotFound(task.task_id)
|
||||||
if not updated_task.status.is_final():
|
if not updated_task.status.is_final():
|
||||||
raise UnexpectedTaskStatus(task_id=updated_task.task_id, status=updated_task.status)
|
raise UnexpectedTaskStatus(task_id=updated_task.task_id, status=updated_task.status)
|
||||||
if updated_task.status == TaskStatus.completed or updated_task.status == TaskStatus.terminated:
|
if updated_task.status == TaskStatus.completed:
|
||||||
LOG.info(
|
LOG.info(
|
||||||
f"Task completed",
|
f"Task completed",
|
||||||
task_id=updated_task.task_id,
|
task_id=updated_task.task_id,
|
||||||
|
|||||||
@@ -143,11 +143,6 @@ async def handle_input_text_action(
|
|||||||
) -> list[ActionResult]:
|
) -> list[ActionResult]:
|
||||||
xpath = await validate_actions_in_dom(action, page, scraped_page)
|
xpath = await validate_actions_in_dom(action, page, scraped_page)
|
||||||
locator = page.locator(f"xpath={xpath}")
|
locator = page.locator(f"xpath={xpath}")
|
||||||
|
|
||||||
current_text = await locator.input_value()
|
|
||||||
if current_text == action.text:
|
|
||||||
return [ActionSuccess()]
|
|
||||||
|
|
||||||
await locator.clear()
|
await locator.clear()
|
||||||
text = get_actual_value_of_parameter_if_secret(task, action.text)
|
text = get_actual_value_of_parameter_if_secret(task, action.text)
|
||||||
await locator.fill(text, timeout=SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS)
|
await locator.fill(text, timeout=SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS)
|
||||||
@@ -318,9 +313,6 @@ async def handle_select_option_action(
|
|||||||
)
|
)
|
||||||
return [ActionFailure(Exception(f"Cannot handle SelectOptionAction on a non-listbox element"))]
|
return [ActionFailure(Exception(f"Cannot handle SelectOptionAction on a non-listbox element"))]
|
||||||
|
|
||||||
current_text = await locator.input_value()
|
|
||||||
if current_text == action.option.label:
|
|
||||||
return ActionSuccess()
|
|
||||||
try:
|
try:
|
||||||
# First click by label (if it matches)
|
# First click by label (if it matches)
|
||||||
await page.click(f"xpath={xpath}", timeout=SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS)
|
await page.click(f"xpath={xpath}", timeout=SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS)
|
||||||
|
|||||||
@@ -505,9 +505,6 @@ function buildTreeFromBody() {
|
|||||||
const selectContainers = document.querySelectorAll(".select2-container");
|
const selectContainers = document.querySelectorAll(".select2-container");
|
||||||
|
|
||||||
selectContainers.forEach((element) => {
|
selectContainers.forEach((element) => {
|
||||||
// hide the select2 container
|
|
||||||
element.style.display = "none";
|
|
||||||
|
|
||||||
// search select in previous
|
// search select in previous
|
||||||
let _pre = element.previousElementSibling;
|
let _pre = element.previousElementSibling;
|
||||||
while (_pre) {
|
while (_pre) {
|
||||||
@@ -516,6 +513,8 @@ function buildTreeFromBody() {
|
|||||||
_pre.style.display === "none"
|
_pre.style.display === "none"
|
||||||
) {
|
) {
|
||||||
_pre.style.removeProperty("display");
|
_pre.style.removeProperty("display");
|
||||||
|
// only hide the select2 container when an alternative select found
|
||||||
|
element.style.display = "none";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_pre = _pre.previousElementSibling;
|
_pre = _pre.previousElementSibling;
|
||||||
@@ -529,6 +528,8 @@ function buildTreeFromBody() {
|
|||||||
_next.style.display === "none"
|
_next.style.display === "none"
|
||||||
) {
|
) {
|
||||||
_next.style.removeProperty("display");
|
_next.style.removeProperty("display");
|
||||||
|
// only hide the select2 container when an alternative select found
|
||||||
|
element.style.display = "none";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_next = _next.nextElementSibling;
|
_next = _next.nextElementSibling;
|
||||||
|
|||||||
Reference in New Issue
Block a user