Jump to content
Sign in to follow this  
ronnieshee

Need help to identify a text Box and enter some values

Recommended Posts

ronnieshee
Posted (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.

AutoItSetOption("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>
"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 by Melba23
Added code tags

Share this post


Link to post
Share on other sites
ronnieshee

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. :(((

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×