Closed jaytho closed 9 years ago
Thanks! Do you have an example of what you'd like to see in the #select
?
Also, if you have suggestions for the README
go ahead and send a pull request for it.
Roger:
Still getting in and understandnig it, so wilco on the pull request when I get it to behave. Just following the Readme and typing in the usage the select throws an error with the select being an internal private method.
I've got an old VB legacy app that ClassName is what I have to search for...
--JT
On Nov 14, 2014, at 12:31 PM, Levi Wilson notifications@github.com wrote:
Thanks! Do you have an example of what you'd like to see in the #select?
— Reply to this email directly or view it on GitHub.
Ahh, thank you. #select
is no longer the method; it has since been renamed to #find
and #find_all
(for searching descendants
). I'll update the README
.
I can look into extending that to include :class_name
, but for now I believe you can do this:
w = Uia.find_element title: /Untitled - Paint/
w.filter(class_name: 'UIRibbonCommandBar') # returns an Array of Elements
I've updated the documentation. Thanks for pointing that out!
Perfect!
I assumed the gem needed Enumerable#select....
I was looking through the specs and typing along (and just saw this title approach (although my title grabs the filename and changes) and after a weekend of UI Automation MSDN and C# I am lovin' it- just lovin' it.
On Nov 14, 2014, at 12:53 PM, Levi Wilson notifications@github.com wrote:
Ahh, thank you. #select is no longer the method; it has since been renamed to #find and #find_all (for searching descendants). I'll update the README.
I can look into extending that to include :class_name, but for now I believe you can do this:
w = Uia.find_element title: /Untitled - Paint/ w.filter(class_name: 'UIRibbonCommandBar') # returns an Array of Elements — Reply to this email directly or view it on GitHub.
Trust me, I feel your pain :-) That's why I had to write the library!
Thanks for the feedback and hit me up if you have any further questions. As you found, the specs are the best place to look for usage.
In addition to uia
, if you're doing automated testing you may want to look at my mohawk gem. It uses uia
as the underlying driver but wraps things in a nice page-object pattern.
You also might be interested in #children
and #descendants
if you want to apply Enumerable
methods.
w.children.select {|e| e.patterns.include? :invoke }.count # => 5
w.descendants.select {|e| e.control_type == :button}.count # => 34
Excellent! I'll check out your automation gem as well.
I looked over the new readme: Is the 'selection' and 'SelectionItem' sections correct on the bottom of the readme? I think there might be another 'select' that needs to be updated.
Regards,
--JT
On Nov 14, 2014, at 1:08 PM, Levi Wilson notifications@github.com wrote:
You also might be interested in #children and #descendants if you want to apply Enumerable methods.
w.children.select {|e| e.patterns.include? :invoke }.count # => 5 w.descendants.select {|e| e.control_type == :button}.count # => 34 — Reply to this email directly or view it on GitHub.
Nope, those are intentional. That is in the Patterns section. When you do element.as(:selection)
it extends your Element
with methods that are applicable for the SelectionPattern
type of UIA element.
Thanks for doing this; Microsoft can learn from you- going through the API is hideous. Your approach is beautiful. Are you thinking of expanding the select queries for any of the other selectors?
may want to include Enumerable on your doc examples, the select tripped me up.
Are you thinking of expanding the select queries for any of the other selectors?