UIA v2
Re: UIA v2
@songdg, the first link actually does show some of the checkboxes, but at a wrong location:
The other links have the checkbox elements in the UIA tree, but they are reported as 0 width and 0 height elements so they aren't highlightable, yet they can still be toggled.
I'm not sure of the exact cause of this problem. It appears it affects multiple browser types (Chrome, Firefox) and the official Accessibility Insights inspection tool has the same issue. Yet Chrome developer consoles (F12) element inspection tool highlights them correctly. Overall this isn't a UIA.ahk problem, but I can't fathom where the cause lies.
I'm not sure of the exact cause of this problem. It appears it affects multiple browser types (Chrome, Firefox) and the official Accessibility Insights inspection tool has the same issue. Yet Chrome developer consoles (F12) element inspection tool highlights them correctly. Overall this isn't a UIA.ahk problem, but I can't fathom where the cause lies.
Re: UIA v2
Thanks, much appreciated your help. I still have a few questions, how to get an active tab's title, how to use GetAllLinks() to get a list of links' title and click on a certain link, say on https://www.procon.org/debate-topics/, I want a list of all the topics and click Artificial Intelligence
-
- Posts: 78
- Joined: 06 May 2017, 11:07
Re: UIA v2
I can't make a piece of example code from the tutorial work.
The code is:
(wap is a UIA object)
Lifted from https://github.com/Descolada/UIA-v2/wiki/05.-Conditions
It gives me the following error:
The code is:
Code: Select all
gn := wap.FindElement({Type:"Button", or:[Name:"Something", Name:"Else"]})
Lifted from https://github.com/Descolada/UIA-v2/wiki/05.-Conditions
It gives me the following error:
Error: Missing "]" before ":"
Re: UIA v2
@elbitjusticiero, it's a typo (missing some brackets), I'll soon correct it. It should be gn := wap.FindElement({Type:"Button", or:[{Name:"Something"}, {Name:"Else"}]}) or gn := wap.FindElement({Type:"Button", Name:["Something", "Else"]}) should also work.
-
- Posts: 78
- Joined: 06 May 2017, 11:07
Re: UIA v2
Hi, sorry for the double post. I have implemented an ugly workaround for controlling RSS Guard, an awesome RSS reader for Windows. In trying to come up with a way to focus on the article list, I found that there seems to be no method that lets me do that.
SetFocus() gives an error: Error: (0x80040201) An event was unable to invoke any of the subscribers
Click() gives an even more cryptic error: Error: (0x80131509)
Invoke() also fails: Error: Method Invoke not found in UIA.IUIAutomationElement Class.
LegacyIAccessible.DoDefaultAction() is a no-go as well: Error: Property LegacyIAccessible not found in UIA.IUIAutomationElement Class.
The only method that kinda works is ControlClick(). But it clicks somewhere near the middle of the list, so it doesn't preserve the article I was viewing, unless it was in that exact position.
Any ideas?
I am attaching a screenshot:
SetFocus() gives an error: Error: (0x80040201) An event was unable to invoke any of the subscribers
Click() gives an even more cryptic error: Error: (0x80131509)
Invoke() also fails: Error: Method Invoke not found in UIA.IUIAutomationElement Class.
LegacyIAccessible.DoDefaultAction() is a no-go as well: Error: Property LegacyIAccessible not found in UIA.IUIAutomationElement Class.
The only method that kinda works is ControlClick(). But it clicks somewhere near the middle of the list, so it doesn't preserve the article I was viewing, unless it was in that exact position.
Any ideas?
I am attaching a screenshot:
- Attachments
-
- clip_20230929_16.21.54.jpg (129.66 KiB) Viewed 3357 times
Re: UIA v2
@elbitjusticiero, yeah Qt apps don't play nice with UIA and often the normal UIA actions don't work (SetFocus, LegacyIAccessiblePattern.DoDefaultAction etc). LegacyIAccessible.DoDefaultAction() didn't work because it should be either only Element.DoDefaultAction() (the pattern is automatically detected) or Element.LegacyIAccessiblePattern.DoDefaultAction(), but these throw an error anyway.
I found that ControlClick-ing the header of the tree seems to set the focus while preserving the selected article. It should be the first element of the tree so the path "RRQRQRQNZ" should work (or in my setup it was "RRQRQR/NZ").
I found that ControlClick-ing the header of the tree seems to set the focus while preserving the selected article. It should be the first element of the tree so the path "RRQRQRQNZ" should work (or in my setup it was "RRQRQR/NZ").
-
- Posts: 78
- Joined: 06 May 2017, 11:07
Re: UIA v2
Sadly, it doesn't work in my machine. ¯\_(ツ)_/¯
I'll keep trying options. I installed Acc (also by you!) but the same thing seems to happen.
I'll keep trying options. I installed Acc (also by you!) but the same thing seems to happen.
-
- Posts: 36
- Joined: 24 Nov 2022, 02:39
Re: UIA v2
Hello
I am also using Edge with this fantastic library.
But i get also thé error comcall ()
I did a workaround with thé dumpall function and fileappend it to an text-file
Then search the info i need and split thé file in different other file if necessary.. With arrays and for loops it kind works
Descolada could you tell me if i use thé library how they library is connecting with thé browser?
I am also using Edge with this fantastic library.
But i get also thé error comcall ()
I did a workaround with thé dumpall function and fileappend it to an text-file
Then search the info i need and split thé file in different other file if necessary.. With arrays and for loops it kind works
Descolada could you tell me if i use thé library how they library is connecting with thé browser?
Re: UIA v2
@elbitjusticiero, both UIA and Acc are based on the same technology so I'm not surprised Acc doesn't work. By "it doesn't work in my machine" do you mean you have determined that rssGuardEl["RRQRQRQNZ"].Highlight() doesn't highlight the Title part of the article list treeview and rssGuardEl["RRQRQRQNZ"].ControlClick() doesn't move keyboard focus to the treeview? In my setup the following highlights and then focuses the treeview when pressing F1 in RSSGuard:
@roeleboele, the ComCall error simply means that something went wrong on the UIAutomation side. Maybe the element isn't accessible (been destroyed perhaps), or doesn't support the requested pattern/method, or any number of other causes. Without having a testable situation (code + name of website) I can't comment any further.
Both UIA-v2 and UIA_Browser are "connecting" to the browser via the UIAutomation interface which is provided by Microsoft. What are you asking exactly?
Code: Select all
#Include <UIA>
#HotIf WinActive("ahk_exe rssguard.exe")
F1::
{
rssGuard := UIA.ElementFromHandle("A")
articleView := rssGuard.FindElement({AutomationId:"FeedsView"})
title := articleView[1].Highlight().ControlClick()
}
Both UIA-v2 and UIA_Browser are "connecting" to the browser via the UIAutomation interface which is provided by Microsoft. What are you asking exactly?
-
- Posts: 78
- Joined: 06 May 2017, 11:07
Re: UIA v2
@Descolada, I think I misunderstood you. ControlClick()ing the tree does focus the tree. I thought it would focus the article list.
With your code, I can send a tab key so that the article list becomes focused.
Thank you so much! You're the best. ツ
With your code, I can send a tab key so that the article list becomes focused.
Thank you so much! You're the best. ツ
-
- Posts: 36
- Joined: 24 Nov 2022, 02:39
Re: UIA v2
@Descolada With my company we use sharepoint. Is it possible that the sites are slower after i use te UIA interface? Some collegues are experiencing that sharepoint is slower. Those problems started when i started to use the uia interface or perhaps it is just an coincidence and is the problerm of the slow sharepoint something elseDescolada wrote: ↑01 Oct 2023, 01:05@elbitjusticiero, both UIA and Acc are based on the same technology so I'm not surprised Acc doesn't work. By "it doesn't work in my machine" do you mean you have determined that rssGuardEl["RRQRQRQNZ"].Highlight() doesn't highlight the Title part of the article list treeview and rssGuardEl["RRQRQRQNZ"].ControlClick() doesn't move keyboard focus to the treeview? In my setup the following highlights and then focuses the treeview when pressing F1 in RSSGuard:@roeleboele, the ComCall error simply means that something went wrong on the UIAutomation side. Maybe the element isn't accessible (been destroyed perhaps), or doesn't support the requested pattern/method, or any number of other causes. Without having a testable situation (code + name of website) I can't comment any further.Code: Select all
#Include <UIA> #HotIf WinActive("ahk_exe rssguard.exe") F1:: { rssGuard := UIA.ElementFromHandle("A") articleView := rssGuard.FindElement({AutomationId:"FeedsView"}) title := articleView[1].Highlight().ControlClick() }
Both UIA-v2 and UIA_Browser are "connecting" to the browser via the UIAutomation interface which is provided by Microsoft. What are you asking exactly?
Re: UIA v2
@roeleboele, UIA is known to be resource-intensive if called multiple times in a loop (eg with WaitElement), so it can be the cause. However, any other cause of high CPU usage might cause that as well (eg running an infinite loop without any Sleeps). When Sharepoint is slow then check out the CPU usage in Task Manager to see what the cause is, and if it's the AHK script then try to figure out which step exactly is causing the high CPU usage and try to eliminate that.
Re: UIA v2
Newbie here, using the example, getting the error.
Re: UIA v2
@WKen, the error message seems to say that you have the class UIA_Vivaldi declared multiple times, which is not possible with the UIA.ahk and UIA_Browser.ahk libraries. Make sure you have downloaded UIA_Browser.ahk properly (perhaps you've copy-pasted it incorrectly?) and haven't included UIA_Browser.ahk multiple times.
Re: UIA v2
Yes. I'm having trouble downloading file in my Edge browser, I use the button to copy, but it's not copied completely maybe because the text is too long. Thanks.
Re: UIA v2
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=104999&p=515298#p515298
I try to convert your context menu code, and have some problem:
Error: This value of type "String" has no method named "HasOwnProp".
▶ 2860: timeOut := condition.HasOwnProp("timeOut") ? condition.timeOut : timeOut
I try to convert your context menu code, and have some problem:
Error: This value of type "String" has no method named "HasOwnProp".
▶ 2860: timeOut := condition.HasOwnProp("timeOut") ? condition.timeOut : timeOut
Code: Select all
MouseClick "right"
WinWait "ahk_class #32768"
contextmenu := UIA.ElementFromHandle(hwnd := WinExist("ahk_class #32768"))
subMenu := contextmenu.WaitElement({Name:"New", Type:"menuitem"})
expandMenu := subMenu.ExpandCollapsePattern.Expand()
WinWait "ahk_class #32768",,, "ahk_id " hwnd
hwnd := WinExist("ahk_class #32768",, "ahk_id " hwnd)
UIA.ElementFromHandle(hwnd).WaitElement("Folder", "menuitem").click()
Re: UIA v2
@songdg, this
probably needs to be
Code: Select all
UIA.ElementFromHandle(hwnd).WaitElement("Folder", "menuitem").click()
Code: Select all
UIA.ElementFromHandle(hwnd).WaitElement({Name:"Folder", Type:"menuitem"}).click()
Re: UIA v2
Thanks, my careless mistakeDescolada wrote: ↑13 Oct 2023, 10:59@songdg, thisprobably needs to beCode: Select all
UIA.ElementFromHandle(hwnd).WaitElement("Folder", "menuitem").click()
Code: Select all
UIA.ElementFromHandle(hwnd).WaitElement({Name:"Folder", Type:"menuitem"}).click()
![Hit my head against the wall. :headwall:](./images/smilies/headwall.gif)
Re: UIA v2
Code: Select all
MsgBox chromeEl.FindElements({Name:"下载", Type:"Button"}).Length
![Image](https://z1.ax1x.com/2023/10/18/piPbhAH.png)