optexity-browser-use 0.9.5__tar.gz → 0.9.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/PKG-INFO +1 -1
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/serializer.py +59 -11
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/views.py +16 -1
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/pyproject.toml +1 -1
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/.gitignore +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/LICENSE +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/README.md +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/element.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/mouse.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/page.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/playground/flights.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/playground/mixed_automation.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/playground/playground.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/utils.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/cloud_events.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/gif.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/judge.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/message_manager/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/message_manager/utils.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/message_manager/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/prompts.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/system_prompt.md +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/system_prompt_flash.md +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/system_prompt_no_thinking.md +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/cloud/cloud.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/cloud/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/events.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/profile.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/python_highlights.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/session.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/session_manager.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/video_recorder.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdog_base.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/aboutblank_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/crash_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/default_action_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/dom_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/downloads_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/local_browser_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/permissions_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/popups_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/recording_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/screenshot_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/security_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdogs/storage_state_watchdog.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/cli.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/formatting.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/namespace.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/notebook_export.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/system_prompt.md +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/utils.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/config.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/controller/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/enhanced_snapshot.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/markdown_extractor.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/playground/extraction.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/playground/multi_act.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/clickable_elements.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/code_use_serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/eval_serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/html_serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/paint_order.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/utils.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/exceptions.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/filesystem/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/filesystem/file_system.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/init_cmd.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/integrations/gmail/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/integrations/gmail/actions.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/integrations/gmail/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/anthropic/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/anthropic/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/chat_anthropic.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/chat_bedrock.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/azure/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/base.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/browser_use/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/browser_use/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/cerebras/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/cerebras/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/deepseek/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/deepseek/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/exceptions.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/google/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/google/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/google/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/groq/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/groq/parser.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/groq/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/messages.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/models.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/oci_raw/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/oci_raw/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/oci_raw/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/ollama/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/ollama/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openai/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openai/like.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openai/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openrouter/chat.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openrouter/serializer.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/schema.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/logging_config.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/mcp/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/mcp/__main__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/mcp/client.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/mcp/controller.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/mcp/server.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/observability.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/py.typed +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/sandbox/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/sandbox/sandbox.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/sandbox/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/screenshots/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/screenshots/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/sync/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/sync/auth.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/sync/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/telemetry/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/telemetry/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/telemetry/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tokens/__init__.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tokens/custom_pricing.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tokens/mappings.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tokens/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tokens/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/registry/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/registry/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/service.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/utils.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/views.py +0 -0
- {optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/utils.py +0 -0
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/serializer/serializer.py
RENAMED
|
@@ -792,19 +792,22 @@ class DOMTreeSerializer:
|
|
|
792
792
|
return False
|
|
793
793
|
|
|
794
794
|
@staticmethod
|
|
795
|
-
def serialize_tree(node: SimplifiedNode | None, include_attributes: list[str], depth: int = 0) -> str:
|
|
795
|
+
def serialize_tree(node: SimplifiedNode | None, include_attributes: list[str], depth: int = 0, remove_empty_nodes: bool = False) -> (list[str], bool):
|
|
796
796
|
"""Serialize the optimized tree to string format."""
|
|
797
797
|
if not node:
|
|
798
|
-
return
|
|
798
|
+
return [], False
|
|
799
|
+
|
|
800
|
+
is_empty_node = False
|
|
799
801
|
|
|
800
802
|
# Skip rendering excluded nodes, but process their children
|
|
801
803
|
if hasattr(node, 'excluded_by_parent') and node.excluded_by_parent:
|
|
802
804
|
formatted_text = []
|
|
803
805
|
for child in node.children:
|
|
804
|
-
|
|
806
|
+
child_formatted_text, child_is_interactive = DOMTreeSerializer.serialize_tree(child, include_attributes, depth, remove_empty_nodes)
|
|
807
|
+
child_text = '\n'.join(child_formatted_text)
|
|
805
808
|
if child_text:
|
|
806
809
|
formatted_text.append(child_text)
|
|
807
|
-
return
|
|
810
|
+
return formatted_text, node.is_interactive
|
|
808
811
|
|
|
809
812
|
formatted_text = []
|
|
810
813
|
depth_str = depth * '\t'
|
|
@@ -814,10 +817,11 @@ class DOMTreeSerializer:
|
|
|
814
817
|
# Skip displaying nodes marked as should_display=False
|
|
815
818
|
if not node.should_display:
|
|
816
819
|
for child in node.children:
|
|
817
|
-
|
|
820
|
+
child_formatted_text, child_is_interactive = DOMTreeSerializer.serialize_tree(child, include_attributes, depth, remove_empty_nodes)
|
|
821
|
+
child_text = '\n'.join(child_formatted_text)
|
|
818
822
|
if child_text:
|
|
819
823
|
formatted_text.append(child_text)
|
|
820
|
-
return
|
|
824
|
+
return formatted_text, node.is_interactive
|
|
821
825
|
|
|
822
826
|
# Special handling for SVG elements - show the tag but collapse children
|
|
823
827
|
if node.original_node.tag_name.lower() == 'svg':
|
|
@@ -843,7 +847,7 @@ class DOMTreeSerializer:
|
|
|
843
847
|
line += ' /> <!-- SVG content collapsed -->'
|
|
844
848
|
formatted_text.append(line)
|
|
845
849
|
# Don't process children for SVG
|
|
846
|
-
return
|
|
850
|
+
return formatted_text, node.is_interactive
|
|
847
851
|
|
|
848
852
|
# Add element if clickable, scrollable, or iframe
|
|
849
853
|
is_any_scrollable = node.original_node.is_actually_scrollable or node.original_node.is_scrollable
|
|
@@ -936,6 +940,14 @@ class DOMTreeSerializer:
|
|
|
936
940
|
scroll_info_text = node.original_node.get_scroll_info_text()
|
|
937
941
|
if scroll_info_text:
|
|
938
942
|
line += f' ({scroll_info_text})'
|
|
943
|
+
else:
|
|
944
|
+
'''
|
|
945
|
+
We mark the node as empty if it has no attributes. like <button />.
|
|
946
|
+
But if it has some attributes, we don't mark it as empty. Like <button class="btn btn-primary">Login</button>.
|
|
947
|
+
We also don't touch scroll stuff as I do not know about that.
|
|
948
|
+
'''
|
|
949
|
+
if not attributes_html_str:
|
|
950
|
+
is_empty_node = True
|
|
939
951
|
|
|
940
952
|
formatted_text.append(line)
|
|
941
953
|
|
|
@@ -950,7 +962,8 @@ class DOMTreeSerializer:
|
|
|
950
962
|
|
|
951
963
|
# Process shadow DOM children
|
|
952
964
|
for child in node.children:
|
|
953
|
-
|
|
965
|
+
child_formatted_text, child_is_interactive = DOMTreeSerializer.serialize_tree(child, include_attributes, next_depth, remove_empty_nodes)
|
|
966
|
+
child_text = '\n'.join(child_formatted_text)
|
|
954
967
|
if child_text:
|
|
955
968
|
formatted_text.append(child_text)
|
|
956
969
|
|
|
@@ -972,13 +985,48 @@ class DOMTreeSerializer:
|
|
|
972
985
|
|
|
973
986
|
# Process children (for non-shadow elements)
|
|
974
987
|
if node.original_node.node_type != NodeType.DOCUMENT_FRAGMENT_NODE:
|
|
988
|
+
child_texts: list[str] = []
|
|
989
|
+
child_is_interactives: list[bool] = []
|
|
975
990
|
for child in node.children:
|
|
976
|
-
|
|
991
|
+
child_formatted_text, child_is_interactive = DOMTreeSerializer.serialize_tree(child, include_attributes, next_depth, remove_empty_nodes)
|
|
992
|
+
child_text = '\n'.join(child_formatted_text)
|
|
993
|
+
if child_text!='':
|
|
994
|
+
child_texts.append(child_text)
|
|
995
|
+
child_is_interactives.append(child_is_interactive)
|
|
996
|
+
|
|
997
|
+
if remove_empty_nodes:
|
|
998
|
+
if is_empty_node and depth >= 0:
|
|
999
|
+
|
|
1000
|
+
if len(child_texts) == 1 and len(formatted_text) > 0:
|
|
1001
|
+
if child_is_interactives[0]:
|
|
1002
|
+
formatted_text.pop()
|
|
1003
|
+
|
|
1004
|
+
'''
|
|
1005
|
+
bring child one level up as this is the new level of child
|
|
1006
|
+
'''
|
|
1007
|
+
if child_texts[0].startswith('\t'):
|
|
1008
|
+
temp = [a[1:] for a in child_texts[0].split("\n")]
|
|
1009
|
+
child_texts[0] = "\n".join(temp)
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
if len(child_texts) > 1 and len(formatted_text) > 0:
|
|
1013
|
+
if all(child_is_interactives):
|
|
1014
|
+
formatted_text.pop()
|
|
1015
|
+
|
|
1016
|
+
'''
|
|
1017
|
+
bring all children one level up as this is the new level of child if they start with a tab
|
|
1018
|
+
'''
|
|
1019
|
+
if all([child_text.startswith('\t') for child_text in child_texts]):
|
|
1020
|
+
for i in range(len(child_texts)):
|
|
1021
|
+
temp = [a[1:] for a in child_texts[i].split("\n")]
|
|
1022
|
+
child_texts[i] = "\n".join(temp)
|
|
1023
|
+
|
|
1024
|
+
for child_text in child_texts:
|
|
977
1025
|
if child_text:
|
|
978
1026
|
formatted_text.append(child_text)
|
|
979
1027
|
|
|
980
|
-
return
|
|
981
|
-
|
|
1028
|
+
return formatted_text, node.is_interactive
|
|
1029
|
+
|
|
982
1030
|
@staticmethod
|
|
983
1031
|
def _build_attributes_string(node: EnhancedDOMTreeNode, include_attributes: list[str], text: str) -> str:
|
|
984
1032
|
"""Build the attributes string for an element."""
|
|
@@ -817,6 +817,7 @@ class SerializedDOMState:
|
|
|
817
817
|
def llm_representation(
|
|
818
818
|
self,
|
|
819
819
|
include_attributes: list[str] | None = None,
|
|
820
|
+
remove_empty_nodes: bool = False,
|
|
820
821
|
) -> str:
|
|
821
822
|
"""Kinda ugly, but leaving this as an internal method because include_attributes are a parameter on the agent, so we need to leave it as a 2 step process"""
|
|
822
823
|
from browser_use.dom.serializer.serializer import DOMTreeSerializer
|
|
@@ -826,7 +827,21 @@ class SerializedDOMState:
|
|
|
826
827
|
|
|
827
828
|
include_attributes = include_attributes or DEFAULT_INCLUDE_ATTRIBUTES
|
|
828
829
|
|
|
829
|
-
|
|
830
|
+
formatted_text, is_interactive = DOMTreeSerializer.serialize_tree(self._root, include_attributes, remove_empty_nodes=remove_empty_nodes)
|
|
831
|
+
final_text = '\n'.join(formatted_text)
|
|
832
|
+
if remove_empty_nodes:
|
|
833
|
+
'''
|
|
834
|
+
remove extra tabs from the beginning of the lines
|
|
835
|
+
'''
|
|
836
|
+
formatted_text = final_text.split('\n')
|
|
837
|
+
for i in range(1,len(formatted_text)):
|
|
838
|
+
prev_tabs = len(formatted_text[i-1]) - len(formatted_text[i-1].lstrip('\t'))
|
|
839
|
+
curr_tabs = len(formatted_text[i]) - len(formatted_text[i].lstrip('\t'))
|
|
840
|
+
while curr_tabs - prev_tabs>1:
|
|
841
|
+
formatted_text[i] = formatted_text[i][1:]
|
|
842
|
+
curr_tabs = len(formatted_text[i]) - len(formatted_text[i].lstrip('\t'))
|
|
843
|
+
final_text = '\n'.join(formatted_text)
|
|
844
|
+
return final_text
|
|
830
845
|
|
|
831
846
|
@observe_debug(ignore_input=True, ignore_output=True, name='eval_representation')
|
|
832
847
|
def eval_representation(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/actor/playground/flights.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/cloud_events.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/system_prompt.md
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/agent/system_prompt_flash.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/cloud/cloud.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/cloud/views.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/python_highlights.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/session_manager.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/video_recorder.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/browser/watchdog_base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/__init__.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/formatting.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/namespace.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/notebook_export.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/code_use/system_prompt.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/controller/__init__.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/enhanced_snapshot.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/markdown_extractor.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/playground/extraction.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/dom/playground/multi_act.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/filesystem/__init__.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/filesystem/file_system.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/anthropic/chat.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/anthropic/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/chat_anthropic.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/chat_bedrock.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/aws/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/browser_use/__init__.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/browser_use/chat.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/cerebras/chat.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/cerebras/serializer.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/deepseek/chat.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/deepseek/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/google/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/google/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/groq/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/oci_raw/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/oci_raw/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/ollama/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openai/serializer.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openrouter/chat.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/llm/openrouter/serializer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/screenshots/__init__.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/screenshots/service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/telemetry/__init__.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/telemetry/service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tokens/custom_pricing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/registry/service.py
RENAMED
|
File without changes
|
{optexity_browser_use-0.9.5 → optexity_browser_use-0.9.5.1}/browser_use/tools/registry/views.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|