ronnieshee Posted March 21, 2018 Share Posted March 21, 2018 (edited) Hello, I am trying to automate a windows WPF client application and have been stuck in the first step itself. So i installed the autoit UIA wrapper and simplespy.au3 can identify my text box in the application. Whenever i am inspecting the text box with simplespy.au3, the below code is being generated. expandcollapse popupAutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=JioGST Wizard- SIT Environment;controltype:=UIA_WindowControlTypeId;class:=Window") ;JioGST Wizard- SIT Environment ;~ $oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=;controltype:=UIA_EditControlTypeId;class:=TextBox") ;ControlType:=UIA_EditControlTypeId;classname:=TextBox") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") _UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click") ;~ *** Standard code Flexible*** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=JioGST Wizard- SIT Environment;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP0,"setfocus") ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") *** Detailed properties of the highlighted element *** UIA_class:= <TextBox> UIA_regexpclass:= <TextBox> UIA_iaccessiblechildId:= <0> UIA_id:= <txtPAN> UIA_handle:= <0> UIA_RuntimeId:= <7;3196;2672115> UIA_BoundingRectangle:= <668;349;180;25> UIA_ProcessId:= <3196> UIA_ControlType:= <50004> UIA_LocalizedControlType:= <edit> UIA_HasKeyboardFocus:= <True> UIA_IsKeyboardFocusable:= <True> UIA_IsEnabled:= <True> UIA_AutomationId:= <txtPAN> UIA_ClassName:= <TextBox> UIA_ClickablePoint:= <758;361> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <0> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_FrameworkId:= <WPF> 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:= <False> 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_ValueIsReadOnly:= <False> UIA_RangeValueValue:= <0> UIA_RangeValueIsReadOnly:= <True> UIA_RangeValueMinimum:= <0> UIA_RangeValueMaximum:= <0> UIA_RangeValueLargeChange:= <0> UIA_RangeValueSmallChange:= <0> UIA_ScrollHorizontalScrollPercent:= <-1> UIA_ScrollHorizontalViewSize:= <100> UIA_ScrollVerticalScrollPercent:= <-1> 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_LegacyIAccessibleRole:= <42> UIA_LegacyIAccessibleState:= <1048580> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:3196,hwnd:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <True> But my problem is how to enter value in this text box. Run("C:\Users\sougato.shee\AppData\Local\Apps\2.0\GYENLTNN.JO0\YNBNK4EG.3H7\jiog..tion_f146abf71bbace54_0002.0000_cb21c4f6195b752d\JioGST Wizard.exe") ;WinWaitActive("JioGST Wizard- SIT Environment") #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=JioGST Wizard- SIT Environment;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP0,"setfocus") ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") _UIA_action($oUIElement,"setVar", "ABCDE9999F") ;my main line to enter text(ABCDE9999F) in the text box I am using the above script and the script runs but nothing happens. @junkew, request your kind help here! Edited March 21, 2018 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
junkew Posted March 22, 2018 Share Posted March 22, 2018 why do you try setVar? In the uiautomation thread you can see which actions are defined. "setvalue","settextvalue" "setvalue using keys" "setValue using clipboard" so your code should change to _UIA_action($oUIElement,"setvalue", "ABCDE9999F") FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
ronnieshee Posted March 28, 2018 Author Share Posted March 28, 2018 hey @junkew, I tired your solution, but still the same thing happens. AutoItSetOption("MustDeclareVars", 1) Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=JioGST Wizard- SIT Environment;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP0,"setfocus") ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_EditControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"setvalue", "ABCDE9999F") The code still runs, but the value does not set. :((( Link to comment Share on other sites More sharing options...
junkew Posted April 7, 2018 Share Posted April 7, 2018 And what are the others like setvalue using keys doing. Maybe first setfocus and double check highligting is working. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now