Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Goal: I'm trying to automate Canva.exe to create designs via GUI automation.

Specs: Spyder V5 (via anaconda) and Python 3.8 on Windows 11 Home OS

Problem: pywinauto is finding duplicate target values for the last 2 lines of my code (below) and giving me the error message (also included below).

Python
import time
from pywinauto.application import Application 

CanvaWin = Application(backend='uia').connect(title='Canva', timeout=100) 
#CanvaWin.Canva.print_control_identifiers()

YP = CanvaWin.Canva.child_window(title="Your projects",control_type="Text").wrapper_object()
YP.click_input()


UP = CanvaWin.Canva.child_window(title="Uploader", control_type="Text").wrapper_object()
UP.click_input()


VT = CanvaWin.Canva.child_window(title="1 OF 2 More actions VideoTemplate Presentation", control_type="Button").wrapper_object()
VT.click_input()

time.sleep(10)

#CanvaWin.Canva.print_control_identifiers()

ETT = CanvaWin.Canva.child_window(title="enter title", control_type="Text").wrapper_object()
ETT.click_input()


Error Message:

Python
ElementAmbiguousError: There are 2 elements that match the criteria {'title': 'enter title', 'control_type': 'Text', 'top_level_only': False, 'parent': <uia_element_info.UIAElementInfo - 'Canva', Chrome_WidgetWin_1, 198500>, 'backend': 'uia'}


What I have tried:

- Pywinauto documentation and help guides
- Started with a variety of google searches
- Checked other coding question forums (stack exchange, quora)
Posted
Updated 10-Apr-22 10:04am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900