预期行为
打印Google Chrome浏览器的控件标识符时遇到问题。我已经在命令提示符中输入了--force-renderer-accessibility
命令并重新启动了Chrome浏览器。
实际行为
Traceback (most recent call last):
File "C:\Users\asdffff\AppData\Roaming\Python\Python39\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
func_val = func(*args, **kwargs)
File "C:\Users\asdffff\AppData\Roaming\Python\Python39\site-packages\pywinauto\findwindows.py", line 87, in find_element
raise ElementNotFoundError(kwargs)
pywinauto.findwindows.ElementNotFoundError: {'title': 'New Tab - Google Chrome', 'backend': 'uia', 'visible_only': False}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\asdffff\OneDrive n1ck99\OneDrive\Documents\python\pywinauto\github.Chrome2.py", line 4, in <module>
app = Application(backend="uia").connect(title='New Tab - Google Chrome',timeout=5)
File "C:\Users\asdffff\AppData\Roaming\Python\Python39\site-packages\pywinauto\application.py", line 990, in connect
self.process = timings.wait_until_passes(
File "C:\Users\asdffff\AppData\Roaming\Python\Python39\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
raise err
pywinauto.timings.TimeoutError
示例代码
from pywinauto.application import Application
app = Application(backend="uia").start(r"C:\Program Files\Google\Chrome\Application\chrome.exe")
app = Application(backend="uia").connect(title='New Tab - Google Chrome',timeout=5)
app.NewTabGoogleChrome.print_control_identifiers()
1条答案
按热度按时间fcg9iug31#
嗨,我也面临着类似的问题,并发现,对于Chrome更改后端到win32
输出: