KhalidAnsari Posted November 16, 2018 Posted November 16, 2018 Hi, I need to automate Java application using AutoIt, I have refer forum for the same, as per forum I am using Java Access Bridge to finding control name. But could not set value to control. Below is my sample code Send("#r") sleep(1500) Send("D:\javaapplication\javaapplication\Hello.jar{Enter}") WinActivate("Penjumlahan") sleep(1500) ControlSetText("Penjumlahan", "", "Name: A :", "demo") Java Application and Java Ferret screen
caramen Posted November 16, 2018 Posted November 16, 2018 (edited) Try to use the search fonction of the forum. Search this without dot : IUIAutomation learning You will have all answer needed. Or watch my signature. Edited November 16, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Aether Posted November 16, 2018 Posted November 16, 2018 I don't think "Name: " should be there, remove it.
caramen Posted November 16, 2018 Posted November 16, 2018 7 minutes ago, Aether said: I don't think "Name: " should be there, remove it. Java application cannot being automated with autoit. Even with the most correct syntax he wont be able to get it work. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
KhalidAnsari Posted November 16, 2018 Author Posted November 16, 2018 Hi, Thanks for the reply. I tried removing Name : still I am not able to set value. My Java Ferret screen is erroring out went i move mouse on my java application. Also I will look into IUIAutomation. Any more help will be appreciated. Thanks
Moderators JLogan3o13 Posted November 16, 2018 Moderators Posted November 16, 2018 @KhalidAnsari Please pay attention to where you're posting. Large difference between the Reply button and the Report button "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
KhalidAnsari Posted November 16, 2018 Author Posted November 16, 2018 @JLogan3o13 Ok. It was done by mistake.
junkew Posted November 16, 2018 Posted November 16, 2018 java applications are not accessible with regular autoit functions. For that you need to handle it with java accessibility bridge https://www.autoitscript.com/forum/topic/166830-java-object-automation-and-simple-spy also check faq 31 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Jasp402 Posted November 16, 2018 Posted November 16, 2018 1 minute ago, junkew said: Las aplicaciones java no son accesibles con las funciones regulares de autoit. Para eso necesitas manejarlo con el puente de accesibilidad java. https://www.autoitscript.com/forum/topic/166830-java-object-automation-and-simple-spy también ver preguntas frecuentes 31 A quick query, do you have an improved or newer version of the Spy?
junkew Posted November 16, 2018 Posted November 16, 2018 nope but if you make one please share it Jasp402 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
junkew Posted November 16, 2018 Posted November 16, 2018 just checked source is still running fine using windows 10 and au3 3.3.14.15 >Running:(3.3.14.5) C:\Program Files\Java\jre1.8.0_181 We are using X64 at cpu X64 Autoit 64 bit version 1 Windows accessbridge 32 opened 1 0 initializeAccessBridge is finishedWindows_run passed : 0hello name: <About...> description: <<html>View information about this version of the JRE</html>> role: <push button> role_en_US: <push button> states: <enabled,focusable,visible,showing,opaque> states_en_US: <enabled,focusable,visible,showing,opaque> indexInParent: <0> childrenCount: <0> x: <1126> y: <277> width: <73> height: <0> FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
KhalidAnsari Posted November 17, 2018 Author Posted November 17, 2018 Hi, @junkew I tried this https://www.autoitscript.com/forum/topic/166830-java-object-automation-and-simple-spy I am using simplespy but i coud not get info apart from title name where was JFrame contain button and textbox. Is I am doing anything wrong. JAB Spy is not showing info I have already enable jabswitch. I am using windows 10 and jdk ver 1.8. I have gone through IUIAutomation link as well. Please let kwn where I am going wrong. Thanks in advance. Below is my screen detail based on simplespy.
junkew Posted November 17, 2018 Posted November 17, 2018 Iuiautomation will only recognize main java window and nothing inside. For jabsimplespy you should compile it first and run as exe. I have sen situations where it will not work from the ide. And probably you have to play and tweak with 32 and 64 bits jab dll. Get it first working on java configuration window. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
KhalidAnsari Posted November 19, 2018 Author Posted November 19, 2018 Hi, @junkew Thanks for reply. I am using Java 64 bit. i have combile jabsimplespy then run as exe it erroring out. Stating jabsimplyspy stopped working. How can I recognize inside control of java window. i am trying Iuiautomation _UIA_getObjectByFindAll , _UIA_getText and _UIA_setText. Thanks for helping.
caramen Posted November 19, 2018 Posted November 19, 2018 @KhalidAnsari Do you did what i said you ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
KhalidAnsari Posted November 19, 2018 Author Posted November 19, 2018 Hi, Thanks for reply. Yes i did it. Still I am not able to get it. I Below is my code. I can able to set focus on title bar but i could not set focus on textbox and set value. Please let me kwn if am doing wrong. Thanks #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Sleep(5000) _UIA_setVar("oP1","Title:=Penjumlahan;controltype:=UIA_WindowControlTypeId;class:=SunAwtFrame") _UIA_setVar("oUIElement","Title:=;controltype:=UIA_TitleBarControlTypeId;class:=") ;ControlType:=UIA_TitleBarControlTypeId;classname:=") _UIA_Action("oP1","setfocus") _UIA_action("oUIElement","highlight") MsgBox(0, "", "Hello")
caramen Posted November 19, 2018 Posted November 19, 2018 So you are able to set focus to Grand Parent > Parent > Child window ? You are able to see your item but you can't play with it ? You not able to see your item ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
KhalidAnsari Posted November 19, 2018 Author Posted November 19, 2018 Yes, I can able to set focus on Grand Parent > Parent > but for child window i cannot able to get control name and set focus as well. I can able to see the item of parent window only for inner textbox and button when i set coursor I did not show details. Thanks
caramen Posted November 19, 2018 Posted November 19, 2018 (edited) Can you show me ONLY the wanted control + the simplespy windows with WANTED CONTROL's simplespy information please ? Full windows of both application please. not only a part. Also when you hit CTRL+W Does the wanted control or somthing else is hightlighted ? Edited November 19, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
KhalidAnsari Posted November 20, 2018 Author Posted November 20, 2018 (edited) Hi @caramen Thanks for reply. Please help and correct me. Below is my java screen. It has control like textbox and button. ------------------------------------------------------------------------------------------------------------------------------------ My au3 script for setting focus and setting value in control which i could not able to find and set it. ;#RequireAdmin #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) WinWaitActive("Penjumlahan") Local $oP3=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Penjumlahan;controltype:=UIA_WindowControlTypeId;class:=SunAwtFrame", $treescope_children) _UIA_Action($oP3,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Penjumlahan;controltype:=UIA_PaneControlTypeId;class:=", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oUIElement=_UIA_getObjectByFindAll($oP3, "title:=;ControlType:=UIA_PaneControlTypeId", $treescope_subtree) _UIA_action($oUIElement,"highlight") ;~_UIA_action($oUIElement,"click") ;~_UIA_action($oUIElement,"setvalue", "ABCDE9999F") ---------------------------------------------------------------------------------------------------------------- Code snippet of SimpleSpy window. I cannot able to find my child control detail. When i keep my mouse pointer on control and press ctrl+w simplespy give me the detail of desktop window. #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP0=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Penjumlahan;controltype:=UIA_WindowControlTypeId;class:=SunAwtFrame", $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_TitleBarControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_TitleBarControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") *** Detailed properties of the highlighted element *** UIA_iaccessiblevalue:= <Penjumlahan> UIA_iaccessiblechildId:= <0> UIA_handle:= <0> UIA_RuntimeId:= <42;328950;1;-2147483647;328950;-2;0> UIA_BoundingRectangle:= <888;197;378;23> UIA_ProcessId:= <580> UIA_ControlType:= <50037> UIA_LocalizedControlType:= <title bar> UIA_HasKeyboardFocus:= <False> UIA_IsKeyboardFocusable:= <True> UIA_IsEnabled:= <True> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <False> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <0> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> 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:= <False> UIA_IsScrollItemPatternAvailable:= <False> UIA_IsSelectionItemPatternAvailable:= <False> UIA_IsSelectionPatternAvailable:= <False> UIA_IsTablePatternAvailable:= <False> UIA_IsTableItemPatternAvailable:= <False> UIA_IsTextPatternAvailable:= <False> UIA_IsTogglePatternAvailable:= <False> UIA_IsTransformPatternAvailable:= <False> UIA_IsValuePatternAvailable:= <True> UIA_IsWindowPatternAvailable:= <False> UIA_ValueValue:= <Penjumlahan> UIA_ValueIsReadOnly:= <False> 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_LegacyIAccessibleValue:= <Penjumlahan> UIA_LegacyIAccessibleDescription:= <Displays the name of the window and contains controls to manipulate it> UIA_LegacyIAccessibleRole:= <1> UIA_LegacyIAccessibleState:= <1048576> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:6536,hwnd:0x0 Annotation:Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <False> Edited November 20, 2018 by KhalidAnsari
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