Jump to content

Recommended Posts

Posted (edited)

Hello,

I'm trying to automate the settings of combo boxes in a program. The combo boxes are child windows of two different windows.  They have the similar but different titles so I can locate them using 'WinList('ES 06-20-NT8')'.  After I locate the windows I need to change the selection in a combo box on each.  I initially tried to use the window handle of the respective windows to create an element for each with '$oUIAutomation.ElementFromHandle( $hWindow, $pWindow )'.  The objects will create and I can read the contents of the combo boxes. When I try to change the value using   .SetValue() the combo box in only one of the windows changes.  WinActivate() or .SetFocus() will change the active window but the combo box will still only change in one of the windows.  Next attempt is to use the '$UIA_AutomationIdPropertyId' & ' $UIA_NativeWindowHandlePropertyId  to create an ''AndCondition'.  I've included the script for this.  The problem now is that each time the program restarts the value for '$UIA_NativeWindowHandlePropertyId ' changes.  If I get the current value using UIASpy and input the values into the script it will work.  I've searched every place I can think of to find out how I can get the current value for '$UIA_NativeWindowHandlePropertyId ' and automate it.  Any suggestions are greatly appreciated.

822558396_AutoItForumPost-FindMultipleWindows01.thumb.png.0d34cb032a5a52d683cce47fa993c725.png1057186657_AutoItForumPost-FindMultipleWindows02.thumb.png.d5c90f428f90d8e1aad33e55259f8391.png

 

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7


#include "C:\Users\Rod\Documents\AutoIt\Include\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder
#include "C:\Users\Rod\Documents\AutoIt\Include\CUIAutomation2WithDuplicateConstantsRemoved.au3"
#include 'Array.au3'

Opt("MustDeclareVars", 1)

Example()

Func Example()
    ; creates an array with 3 rows
    Local $aArr = WinList('ES 06-20-NT8')
    _ArrayDisplay($aArr)
    
    For $i = 1 To UBound($aArr) - 1
        ConsoleWrite($aArr[$i][0] & '  ' & $aArr[$i][1] & @CRLF)
    Next
    
    ; tried window handle for property condition in '$UIA_NativeWindowHandlePropertyId' but it doesn't work
    ; Local $hWnd = WinGetHandle($aArr[1][0])
    ; Create UI Automation object
    Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation8, $sIID_IUIAutomation5, $dtag_IUIAutomation5)
    If Not IsObj($oUIAutomation) Then Return ConsoleWrite("$oUIAutomation ERR" & @CRLF)
    ConsoleWrite("$oUIAutomation OK" & @CRLF)

    ; Get Desktop element
    Local $pDesktop, $oDesktop
    $oUIAutomation.GetRootElement($pDesktop)
    $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8)
    If Not IsObj($oDesktop) Then Return ConsoleWrite("$oDesktop ERR" & @CRLF)
    ConsoleWrite("$oDesktop OK" & @CRLF)

    ; --- Find window/control ---

    ConsoleWrite("--- Find window/control ---" & @CRLF)
    Local $pCondition0, $pCondition1, $pAndCondition1
    $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "accountComboBox", $pCondition0)
    $oUIAutomation.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, 0x001506B6, $pCondition1)
    $oUIAutomation.CreateAndCondition($pCondition0, $pCondition1, $pAndCondition1)
    If Not $pAndCondition1 Then Return ConsoleWrite("$pAndCondition1 ERR" & @CRLF)
    ConsoleWrite("$pAndCondition1 OK" & @CRLF)

    Local $pComboBox1, $oComboBox1
    $oDesktop.FindFirst($TreeScope_Descendants, $pAndCondition1, $pComboBox1)
    $oComboBox1 = ObjCreateInterface($pComboBox1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8)
    If Not IsObj($oComboBox1) Then Return ConsoleWrite("$oComboBox1 ERR" & @CRLF)
    ConsoleWrite("$oComboBox1 OK" & @CRLF)

    ; --- LegacyIAccessible Pattern (action) Object ---

    ConsoleWrite("--- LegacyIAccessible Pattern (action) Object ---" & @CRLF)

    Local $pLegacyIAccessiblePattern1, $oLegacyIAccessiblePattern1
    $oComboBox1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1)
    $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern)
    If Not IsObj($oLegacyIAccessiblePattern1) Then Return ConsoleWrite("$oLegacyIAccessiblePattern1 ERR" & @CRLF)
    ConsoleWrite("$oLegacyIAccessiblePattern1 OK" & @CRLF)

    ; --- LegacyIAccessible Pattern (action) Methods ---

    ConsoleWrite("--- LegacyIAccessible Pattern (action) Methods ---" & @CRLF)
    Local $sValue
    $oLegacyIAccessiblePattern1.CurrentValue($sValue)
    ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue() = " & $sValue & @CRLF)

    ; --- Value Pattern (action) Object ---

    ConsoleWrite("--- Value Pattern (action) Object ---" & @CRLF)

    Local $pValuePattern1, $oValuePattern1
    $oComboBox1.GetCurrentPattern($UIA_ValuePatternId, $pValuePattern1)
    $oValuePattern1 = ObjCreateInterface($pValuePattern1, $sIID_IUIAutomationValuePattern, $dtag_IUIAutomationValuePattern)
    If Not IsObj($oValuePattern1) Then Return ConsoleWrite("$oValuePattern1 ERR" & @CRLF)
    ConsoleWrite("$oValuePattern1 OK" & @CRLF)

    ; --- Value Pattern (action) Methods ---

    ConsoleWrite("--- Value Pattern (action) Methods ---" & @CRLF)

    $oValuePattern1.SetValue('NT8-Sim 03 Tue')
    ConsoleWrite("$oValuePattern1.SetValue()" & @CRLF)
    $oLegacyIAccessiblePattern1.CurrentValue($sValue)
    ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue() = " & $sValue & @CRLF)


    ; --- Find window/control ---

    ConsoleWrite("--- Find window/control ---" & @CRLF)

    ; --- Find window/control ---

    ConsoleWrite("--- Find window/control ---" & @CRLF)

    $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "accountComboBox", $pCondition0)
    $oUIAutomation.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, 0x0010069E, $pCondition1)
    $oUIAutomation.CreateAndCondition($pCondition0, $pCondition1, $pAndCondition1)
    If Not $pAndCondition1 Then Return ConsoleWrite("$pAndCondition1 ERR" & @CRLF)
    ConsoleWrite("$pAndCondition1 OK" & @CRLF)

    $oDesktop.FindFirst($TreeScope_Descendants, $pAndCondition1, $pComboBox1)
    $oComboBox1 = ObjCreateInterface($pComboBox1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8)
    If Not IsObj($oComboBox1) Then Return ConsoleWrite("$oComboBox1 ERR" & @CRLF)
    ConsoleWrite("$oComboBox1 OK" & @CRLF)

    ; --- LegacyIAccessible Pattern (action) Object ---

    ConsoleWrite("--- LegacyIAccessible Pattern (action) Object ---" & @CRLF)

    $oComboBox1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1)
    $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern)
    If Not IsObj($oLegacyIAccessiblePattern1) Then Return ConsoleWrite("$oLegacyIAccessiblePattern1 ERR" & @CRLF)
    ConsoleWrite("$oLegacyIAccessiblePattern1 OK" & @CRLF)

    ; --- LegacyIAccessible Pattern (action) Methods ---

    ConsoleWrite("--- LegacyIAccessible Pattern (action) Methods ---" & @CRLF)

    $oLegacyIAccessiblePattern1.CurrentValue($sValue)
    ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue()" & $sValue & @CRLF)

    ; --- Value Pattern (action) Object ---

    ConsoleWrite("--- Value Pattern (action) Object ---" & @CRLF)

    $oComboBox1.GetCurrentPattern($UIA_ValuePatternId, $pValuePattern1)
    $oValuePattern1 = ObjCreateInterface($pValuePattern1, $sIID_IUIAutomationValuePattern, $dtag_IUIAutomationValuePattern)
    If Not IsObj($oValuePattern1) Then Return ConsoleWrite("$oValuePattern1 ERR" & @CRLF)
    ConsoleWrite("$oValuePattern1 OK" & @CRLF)

    ; --- Value Pattern (action) Methods ---

    ConsoleWrite("--- Value Pattern (action) Methods ---" & @CRLF)

    $oValuePattern1.SetValue('NT8-Sim 03 Tue')
    ConsoleWrite("$oValuePattern1.SetValue()" & @CRLF)
    $oLegacyIAccessiblePattern1.CurrentValue($sValue)
    ConsoleWrite("$oLegacyIAccessiblePattern1.CurrentValue() = " & $sValue & @CRLF)

EndFunc   ;==>Example

 

Output from script

ES 06-20-NT8-Sim 02 Mon  0x05D50AAA
ES 06-20-NT8-Sim04 Wed  0x001208B8
$oUIAutomation OK
$oDesktop OK
--- Find window/control ---
$pAndCondition1 OK
$oComboBox1 OK
--- LegacyIAccessible Pattern (action) Object ---
$oLegacyIAccessiblePattern1 OK
--- LegacyIAccessible Pattern (action) Methods ---
$oLegacyIAccessiblePattern1.CurrentValue() = NT8-Sim 02 Mon
--- Value Pattern (action) Object ---
$oValuePattern1 OK
--- Value Pattern (action) Methods ---
$oValuePattern1.SetValue()
$oLegacyIAccessiblePattern1.CurrentValue() = NT8-Sim 03 Tue
--- Find window/control ---
--- Find window/control ---
$pAndCondition1 OK
$oComboBox1 OK
--- LegacyIAccessible Pattern (action) Object ---
$oLegacyIAccessiblePattern1 OK
--- LegacyIAccessible Pattern (action) Methods ---
$oLegacyIAccessiblePattern1.CurrentValue()NT8-Sim04 Wed
--- Value Pattern (action) Object ---
$oValuePattern1 OK
--- Value Pattern (action) Methods ---
$oValuePattern1.SetValue()
$oLegacyIAccessiblePattern1.CurrentValue() = NT8-Sim 03 Tue

Thanks in advance.

Edited by rmckay
Script below 3rd commented line was in red. I apologized and when I submitted the article the script was in normal color.
Posted

junkew,

Thanks for taking the time to look at this.  I'll put the code together and post it.  It'll have it here later today.

 

Posted

Hi junkew,

I was able to simplify the problem as the windows and the combo boxes they contain are direct descendants of the desktop.  Using .FindAll() gets them without a problem.  Then it's just am matter of setting a new value. I do have another question.  You mention using nextchild to descend the tree view.  I'm pretty new to Autoit still and have not attempted to locate items above or below using tree view.  Can I ascend the tree from the elements I located and end up with the name of the respective windows?

Thanks again

Opt("MustDeclareVars", 1)
Example()

Func Example()

    ; Create UI Automation object
    Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation8, $sIID_IUIAutomation5, $dtag_IUIAutomation5)
    If Not IsObj($oUIAutomation) Then Return ConsoleWrite("$oUIAutomation ERR" & @CRLF)
    ConsoleWrite("$oUIAutomation OK" & @CRLF)
    
    ; Get Desktop element
    Local $pDesktop, $oDesktop
    $oUIAutomation.GetRootElement($pDesktop)
    $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8)
    If Not IsObj($oDesktop) Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oDesktop ERR" & @CRLF)
    ConsoleWrite(':' & @ScriptLineNumber & ':' & " $oDesktop OK" & @CRLF)

    Local $pConditionComboBox
    $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "accountComboBox", $pConditionComboBox)
    If Not $pConditionComboBox Then Return ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pConditionComboBox ERR" & @CRLF)
    ConsoleWrite(':' & @ScriptLineNumber & ':' & " $pConditionComboBox OK" & @CRLF)

    Local $pElements
    $oDesktop.FindAll($TreeScope_Descendants, $pConditionComboBox, $pElements)

    Local $oUIElementArray1, $iLength1 ; $pElements is a pointer to an UI Automation element array
    $oUIElementArray1 = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray)
    $oUIElementArray1.Length($iLength1)
    Local $pElement1, $oElement1, $sValue1
    For $i = 0 To $iLength1 - 1
        $oUIElementArray1.GetElement($i, $pElement1)
        $oElement1 = ObjCreateInterface($pElement1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)

        Local $pLegacyIAccessiblePattern1, $oLegacyIAccessiblePattern1
        $oElement1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1)
        $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern)

        $oLegacyIAccessiblePattern1.CurrentValue($sValue1)
        ConsoleWrite(':' & @ScriptLineNumber & ':' & ' ' & $i & " $sValue1 = " & $sValue1 & @CRLF)

        Local $pLegacyPatternInstrumentBox, $oLegacyPatternInstrumentBox
        $oElement1.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyPatternInstrumentBox)
        $oLegacyPatternInstrumentBox = ObjCreateInterface($pLegacyPatternInstrumentBox, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern)

        Local $sValueValue1
        $oElement1.GetCurrentPropertyValue($UIA_ValueValuePropertyId, $sValueValue1)
        ConsoleWrite(':' & @ScriptLineNumber & ':' & " $sValueValue1 = " & $sValueValue1 & @CRLF)

        Local $sMyIntInputnput = 'NT8-Sim 07 Sat'
        $oLegacyPatternInstrumentBox.SetValue($sMyIntInputnput)

        $oElement1.GetCurrentPropertyValue($UIA_ValueValuePropertyId, $sValueValue1)
        ConsoleWrite(':' & @ScriptLineNumber & ':' & " $sValueValue1 = " & $sValueValue1 & @CRLF)


    Next

EndFunc   ;==>Example

 

Posted (edited)

The uiautomation is not AutoIt related just wrapped the ui automation from microsoft. With treewalker examples you can walk childs parents etc. Search for walker in the examples.zip but also in the forum will give you hits. @LarsJ has written nice detailed threads on usage of the whole ui automation api.

Simplespy source will give you an idea how to walk to (grand)parents

 

Edited by junkew
Posted

Just ask and let us know where you see the complexity so I can change the introduction post and/or examples

Simple explanation

  1. A desktop screen has a list of objects
  2. Iterate thru arraylist of objects till object is found based on a property value

 

Complexity

  1. A desktop screen is a hierarchy of objects
    1. Most people I explain automation I ask make a hierarchy picture of your objects on a white paper (spy tools do this for you)
    2. Be aware that objects have weird relations sometimes
  2. Walk iteratively  thru the hierarchy from top down (or from leafs up) to childs from left to right till object is found based on a property value
  3. Many "weird" objects that do not play by the rules of automation or bad developers not naming their objects for accessibility

 

Some explanation

  • findall creates a list and flattens the hierarchy to an arraylist but is slow (certainly with thousands of html elements)
  • findone is fast but complex as you have to create property conditions
  • walkers are nice to iterate up/down/left/right to find elements that are close to each other
  • eventhandlers are very powerfull but for most seem to be complex to understand
  • uiawrappers UDF abstracted a way to be more flexible at cost of speed
    • index/indexrelative
    • regular expressions
    • string syntax similar (but different) to AutoIt

 

 

Posted

Hi @junkew

Thanks for the overview.  Some of the steps are starting to fall in into place.  I am working on a project (described in a post - 'Retrieve items from combo box with FindAll()') and need to try a different approach.  The goal is finding a combo box located on a web page and getting the contents with FindAll().  The problem is that SimpleSpy and UIASpy don't show the combo box most of the time.  Sometimes it will appear in Inspect. (I've tried all of the On/Off iterations of Chrome://accessibility I can think of) I'm going to start with treewalker.  I first need to do some reading and experimenting.  Will treewalker find  elements that are not picked up by spy software?

Thanks

Posted

The issue you observe can be explained that objects are on top of each other technically. Inspect.exe will tell you true hierarchy. Treewalkers will find the same. If you spy html in chrome you can see based on highlighted area if accessibility is on or off.  If it really is not working you can spy browsers thru addressbar by executing small javascript pieces. 

Type in addressbar copy paste will not work as it strips javascript away. Be aware to lookup correct case sensitive syntax.

javascript:alert(document.body.innertext) 

 

Posted

@junkew I've found the contents of the combo box I  was looking for in the web page html:

<select name="myposition_length" aria-controls="myposition" class="">
    <option value="10">10</option>
    <option value="15">15</option>
    <option value="30">30</option>
    <option value="-1">All</option>
</select>

My knowledge about web page information consists of zero but I'm guessing that 'name="myposition_length"' is what I'm looking for with treewalker.  Is that the right direction?  Like I mentioned before - I've got some serious research to do before I can ask intelligent questions.

Thanks again @junkew

Posted

Hard to say there are many different webpage constructions. Do you see it on the accessibility page of chrome? What is highlighted when you check with simplespy? To use uiautomation you should see it in inspect.exe in the tree and be able to highlight it. If that all does not work the addressbar javascript is the only possibility to get full access to full html dom tree.

Posted

Accessibility Tree:

2140419567_ComboBoxAccessibilityTree.png.0e5b55e93646a01106fb50a3fee26cd8.png

SimpleSpy output:

https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/?do=findComment&comment=1156373 
At least we have an element title: [My Trades | Webstats] class: [Chrome_RenderWidgetHostHWND]

Having the following values for all properties: 
Title is: <My Trades | Webstats>    Class   := <Chrome_RenderWidgetHostHWND>    controltype:= <UIA_DocumentControlTypeId>   ,<50030>    , (0000C36E)    2923;-687;94;93
*** Parent Information top down ***
0: Title is: <> Class   := <Chrome_WidgetWin_1> controltype:= <UIA_PaneControlTypeId>   ,<50033>    , (0000C371)    2923;-687;94;93
"Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1"" 


;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1")   ;

_UIA_setVar("MyTrades|Webstats.mainwindow","title:=My Trades | Webstats;classname:=Chrome_RenderWidgetHostHWND")

;~ Actions split away from logical/technical definition above can come from configfiles 

;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")

_UIA_action("MyTrades|Webstats.mainwindow","setfocus")


;~ *** Standard code Flexible***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children)  
_UIA_Action($oP0,"setfocus")
_UIA_setVar("MyTrades|Webstats.mainwindow","title:=My Trades | Webstats;classname:=Chrome_RenderWidgetHostHWND")
_UIA_action("MyTrades|Webstats.mainwindow","setfocus")


*** Detailed properties of the highlighted element ***
UIA_title:= <My Trades | Webstats>
UIA_text:= <My Trades | Webstats>
UIA_regexptitle:= <My Trades | Webstats>
UIA_class:= <Chrome_RenderWidgetHostHWND>
UIA_regexpclass:= <Chrome_RenderWidgetHostHWND>
UIA_iaccessiblevalue:= <https://app.journalytix.me/report>
UIA_iaccessiblechildId:= <0>
UIA_id:= <-1317983088>
UIA_handle:= <593196>
UIA_RuntimeId:= <42;593196;4;-34785>
UIA_BoundingRectangle:= <2923;-687;94;93>
UIA_ProcessId:= <6096>
UIA_ControlType:= <50030>
UIA_LocalizedControlType:= <document>
UIA_Name:= <My Trades | Webstats>
UIA_HasKeyboardFocus:= <False>
UIA_IsKeyboardFocusable:= <True>
UIA_IsEnabled:= <True>
UIA_AutomationId:= <-1317983088>
UIA_ClassName:= <Chrome_RenderWidgetHostHWND>
UIA_Culture:= <0>
UIA_IsControlElement:= <True>
UIA_IsContentElement:= <True>
UIA_IsPassword:= <False>
UIA_NativeWindowHandle:= <593196>
UIA_IsOffscreen:= <False>
UIA_Orientation:= <0>
UIA_FrameworkId:= <Chrome>
UIA_IsRequiredForForm:= <False>
UIA_IsDockPatternAvailable:= <False>
UIA_IsExpandCollapsePatternAvailable:= <False>
UIA_IsGridItemPatternAvailable:= <False>
UIA_IsGridPatternAvailable:= <False>
UIA_IsInvokePatternAvailable:= <False>
UIA_IsMultipleViewPatternAvailable:= <False>
UIA_IsRangeValuePatternAvailable:= <False>
UIA_IsScrollPatternAvailable:= <True>
UIA_IsScrollItemPatternAvailable:= <True>
UIA_IsSelectionItemPatternAvailable:= <False>
UIA_IsSelectionPatternAvailable:= <False>
UIA_IsTablePatternAvailable:= <False>
UIA_IsTableItemPatternAvailable:= <False>
UIA_IsTextPatternAvailable:= <True>
UIA_IsTogglePatternAvailable:= <False>
UIA_IsTransformPatternAvailable:= <False>
UIA_IsValuePatternAvailable:= <True>
UIA_IsWindowPatternAvailable:= <False>
UIA_ValueValue:= <https://app.journalytix.me/report>
UIA_ValueIsReadOnly:= <True>
UIA_RangeValueValue:= <0>
UIA_RangeValueIsReadOnly:= <True>
UIA_RangeValueMinimum:= <0>
UIA_RangeValueMaximum:= <0>
UIA_RangeValueLargeChange:= <0>
UIA_RangeValueSmallChange:= <0>
UIA_ScrollHorizontalScrollPercent:= <0>
UIA_ScrollHorizontalViewSize:= <100>
UIA_ScrollVerticalScrollPercent:= <0>
UIA_ScrollVerticalViewSize:= <100>
UIA_ScrollHorizontallyScrollable:= <False>
UIA_ScrollVerticallyScrollable:= <False>
UIA_SelectionCanSelectMultiple:= <False>
UIA_SelectionIsSelectionRequired:= <False>
UIA_GridRowCount:= <0>
UIA_GridColumnCount:= <0>
UIA_GridItemRow:= <0>
UIA_GridItemColumn:= <0>
UIA_GridItemRowSpan:= <1>
UIA_GridItemColumnSpan:= <1>
UIA_DockDockPosition:= <5>
UIA_ExpandCollapseExpandCollapseState:= <3>
UIA_MultipleViewCurrentView:= <0>
UIA_WindowCanMaximize:= <False>
UIA_WindowCanMinimize:= <False>
UIA_WindowWindowVisualState:= <0>
UIA_WindowWindowInteractionState:= <0>
UIA_WindowIsModal:= <False>
UIA_WindowIsTopmost:= <False>
UIA_SelectionItemIsSelected:= <False>
UIA_TableRowOrColumnMajor:= <2>
UIA_ToggleToggleState:= <2>
UIA_TransformCanMove:= <False>
UIA_TransformCanResize:= <False>
UIA_TransformCanRotate:= <False>
UIA_IsLegacyIAccessiblePatternAvailable:= <True>
UIA_LegacyIAccessibleChildId:= <0>
UIA_LegacyIAccessibleName:= <My Trades | Webstats>
UIA_LegacyIAccessibleValue:= <https://app.journalytix.me/report>
UIA_LegacyIAccessibleRole:= <15>
UIA_LegacyIAccessibleState:= <1048640>
UIA_IsDataValidForForm:= <True>
UIA_ProviderDescription:= <[pid:15872,providerId:0x90D2C Main:Nested [pid:6096,providerId:0x90D2C Annotation(parent link):Microsoft: Annotation Proxy (unmanaged:UIAutomationCore.DLL); Main:Microsoft: MSAA Proxy (IAccessible2) (unmanaged:UIAutomationCore.DLL)]; Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]>
UIA_IsItemContainerPatternAvailable:= <False>
UIA_IsVirtualizedItemPatternAvailable:= <False>
UIA_IsSynchronizedInputPatternAvailable:= <False>
UIA_OptimizeForVisualContent:= <False>
UIA_IsObjectModelPatternAvailable:= <False>
UIA_AnnotationAnnotationTypeId:= <60000>
UIA_IsAnnotationPatternAvailable:= <False>
UIA_IsTextPattern2Available:= <True>
UIA_StylesStyleId:= <0>
UIA_StylesFillColor:= <0>
UIA_StylesFillPatternColor:= <0>
UIA_IsStylesPatternAvailable:= <False>
UIA_IsSpreadsheetPatternAvailable:= <False>
UIA_IsSpreadsheetItemPatternAvailable:= <False>
UIA_Transform2CanZoom:= <False>
UIA_IsTransformPattern2Available:= <False>
UIA_LiveSetting:= <0>
UIA_IsTextChildPatternAvailable:= <False>
UIA_IsDragPatternAvailable:= <False>
UIA_DragIsGrabbed:= <False>
UIA_IsDropTargetPatternAvailable:= <False>
UIA_Transform2ZoomLevel:= <1>
UIA_Transform2ZoomMinimum:= <1>
UIA_Transform2ZoomMaximum:= <1>
UIA_IsTextEditPatternAvailable:= <False>
UIA_IsPeripheral:= <False>
UIA_IsCustomNavigationPatternAvailable:= <False>
UIA_PositionInSet:= <0>
UIA_SizeOfSet:= <0>
UIA_Level:= <0>
UIA_LandmarkType:= <0>
UIA_FillType:= <0>
UIA_VisualEffects:= <0>
UIA_IsSelectionPattern2Available:= <False>
UIA_Selection2ItemCount:= <0>
UIA_HeadingLevel:= <80050>
UIA_IsDialog:= <False>

Highlight with Simplespy:

103326599_ScreenShotofMyTradesComboBox.thumb.jpg.8fddab6c498ec3318f8444cb3706c040.jpg

When I enter 'javascript:alert(document.body.innertext) ' into the address bar it just brings up a google search for "javascript:alert(document.body.innertext) ".  I'm misunderstanding  what I'm supposed to do with that action I think.  Inspect does show the combo box and it's contents in the tree.  

Thanks for all the effort.  

Posted

Seems with simplespy accessibility is turned off.

As inspect is seeing it no need for javascript as thats far more difficult.

It does not make difference findall or a treewalker. Do a findall with only one chrome tab open and print all objects and property name. Most likely simplespy is working better when inspect is running. Somehow chrome thinks accessibility is off. You can start chrome with cmdline parameters to make sure accessibility is on.

Open on tab 1 your html page and on ab 2 accessibility turned on then back to tab 1 and check with simplespy.

Posted

This is what the accessibility page shows when started with cmdline parameters:

(I checked the Internal box)

166637935_AccessibilityScreenShot.thumb.png.d8504efa80509d889e0983fdb3113aed.png

Screen shot of Inspect:651337338_InspectDisplay.thumb.png.44c834ce116712210915547493c84f2e.png

SimpleSpy out put is same:

https://www.autoitscript.com/forum/topic/153520-iuiautomation-ms-framework-automate-chrome-ff-ie/?do=findComment&comment=1156373 
At least we have an element title: [] class: [Chrome_RenderWidgetHostHWND]

Having the following values for all properties: 
Title is: <>    Class   := <Chrome_RenderWidgetHostHWND>    controltype:= <UIA_DocumentControlTypeId>   ,<50030>    , (0000C36E)    603;-602;94;93
*** Parent Information top down ***
0: Title is: <> Class   := <Chrome_WidgetWin_1> controltype:= <UIA_PaneControlTypeId>   ,<50033>    , (0000C371)    603;-602;94;93
"Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1"" 


;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1")   ;

_UIA_setVar(".mainwindow","title:=;classname:=Chrome_RenderWidgetHostHWND")

;~ Actions split away from logical/technical definition above can come from configfiles 

;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")

_UIA_action(".mainwindow","setfocus")


;~ *** Standard code Flexible***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children)  
_UIA_Action($oP0,"setfocus")
_UIA_setVar(".mainwindow","title:=;classname:=Chrome_RenderWidgetHostHWND")
_UIA_action(".mainwindow","setfocus")

Thank you so much for taking the time to look at this @junkew.  Rather than wasting more of your time, let me make some attempts at findall and treewalker.  Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...