Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking screenshot using relative coordinates #61

Open
Ashish3080 opened this issue Nov 2, 2023 · 4 comments
Open

Taking screenshot using relative coordinates #61

Ashish3080 opened this issue Nov 2, 2023 · 4 comments

Comments

@Ashish3080
Copy link

Hi, I want to take screenshots of elements when being clicked while recording using the relative coordinates. For instance, while trying to record calculator, I clicked on the button '3' and got this in the generated script 'click(u"Three||Button%(-32.14,-18.67)")'. I want to take a screenshot as per these coordinates when this button is clicked. Could you please help me get through this issue?

Copy link

github-actions bot commented Nov 2, 2023

Thank you very much for sharing this first issue.

@beuaaa
Copy link
Owner

beuaaa commented Dec 6, 2023

Hello,

Sorry for my late reply.
%(-32.14,-18.67) is the relative coordinate of the click. This value is optional.
These two values are percentage offsets. 0% means that it is on the left edge of the clicked element and 100% means that it is on the right edge of the element. If the value is negative or greater than 100%, it means that it is outside the clicked element.

If you want to obtain a screenshot of an element :

wrapper = find("Three||Button"")
img = wrapper.capture_as_image().convert('RGB')
img.save("D:\screenshot.png")

Does this answer your question?

@Ashish3080
Copy link
Author

Hi, is it possible in pywinauto_recorder to just record the elements with their element_ids with the actions performed on them so that they can be stored in a json?

@beuaaa
Copy link
Owner

beuaaa commented Jan 4, 2024

No, this is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants