Skip to content

AttributeError: 'NoneType' object has no attribute 'capture_as_image' #232

Description

@JackWong007

ENV :
UFO:2.0.0
PYTHON:3.10.10

D:\data\UFO2>python -m ufo --task helloufo004

Welcome to use UFO🛸, A UI-focused Agent for Windows OS Interaction.


| | | || | / _
| | | || |
| | | |
| |
| || | | || |
_
/ |_| __/

Please enter your request to be completed🛸:
在打开的记事本中,输入Hello UFO

Round 1, Step 1, HostAgent: Analyzing the user intent and decomposing the request...
Observations👀: The current screenshot shows Visual Studio Code with several files open, a Command Prompt window running a Python script, and a Notepad window open with no text yet. Notepad is in focus and waiting for input.
Thoughts💡: The user's request is to input 'Hello UFO' into the opened Notepad document. This task can be completed entirely within the Notepad application, as it is currently open and ready to receive text input.
Plans📚: (1) Input 'Hello UFO' into the opened Notepad document.
Next Selected application📲: 无标题 - 记事本
Messages to AppAgent📩:
Status📊: ASSIGN
Comment💬: I will instruct an AppAgent to enter 'Hello UFO' into the currently open Notepad document, completing the user's request.
Round 1, Step 2, AppAgent: Completing the subtask [Input 'Hello UFO' into the opened Notepad document.] on application [].


Error Occurs at capture_screenshot
Traceback (most recent call last):
File "D:\data\UFO2\ufo\agents\processors\basic.py", line 192, in wrapper
func(self, *args, **kwargs)
File "D:\data\UFO2\ufo\agents\processors\basic.py", line 174, in wrapper
result = func(self, *args, **kwargs)
File "D:\data\UFO2\ufo\agents\processors\app_agent_processor.py", line 282, in capture_screenshot
self.photographer.capture_app_window_screenshot(
File "D:\data\UFO2\ufo\automator\ui_control\screenshot.py", line 528, in capture_app_window_screenshot
return screenshot.capture(save_path, scalar)
File "D:\data\UFO2\ufo\automator\ui_control\screenshot.py", line 79, in capture
screenshot = self.control.capture_as_image()
AttributeError: 'NoneType' object has no attribute 'capture_as_image'


Markdown file saved to logs/helloufo004//output.md.

Activity

  1. AirhornRemix commented on May 30, 2025

    @AirhornRemix

    Does anyone have any updates here? The error seems to occur because the APPLICATION_WINDOW context element is not being set correctly. Something with UIA might potentially be the cause.

  2. nice-mee commented on Jun 12, 2025

    @nice-mee
    Contributor

    JackWong (@JackWong007) Adam Beauchaine (@AirhornRemix) I can't seem to reproduce this issue on my end. I tested with the command: python -m ufo --task new1 -r "在打开的记事本中,输入Hello UFO".

    Could you please share which model you're using? If possible, would you also provide the response.log and request.log files from the logs dir in a pastebin?

  3. imAndyrrr commented on Jul 29, 2025

    @imAndyrrr

    我也遇到了同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions