tester123 Posted August 26, 2013 Posted August 26, 2013 (edited) Hi All, I am attempting to automate a Java SWT based Eclipse RCP application using AutoIt. I tried searching but couldn't find enough information if AutoIt is a suitable tool for this purpose. Anyways, I went ahead with scripting and using the control handle I'm able to see most of the controls on the eclipse window. However, the left side of the Eclipse has a tree structure and I'm unable to click on them. I tried using ControlTreeView but I guess it is not able to recognise the node that it needs to click on. '?do=embed' frameborder='0' data-embedContent>> has the solution to one of my earlier questions which I use for getting all the controls on the screen. Only that it is unable to pull out systreeview controls Any help is much appreciated!! Edited August 26, 2013 by tester123
Solution dragan Posted August 26, 2013 Solution Posted August 26, 2013 I'm not sure that you can get text from those items, but you can automate them: #include <GuiTreeView.au3> _Main() Func _Main() Local $EclipseHWND = WinGetHandle('[CLASS:SWT_Window0]') If NOT IsHWnd($EclipseHWND) Then MsgBox(0, 'Error', 'NO Eclipse winHandle') Return SetError(1, 0, 0) EndIf Local $treeViewCtrl = ControlGetHandle($EclipseHWND, '', "[CLASS:SysTreeView32; INSTANCE:1]") If NOT IsHWnd($treeViewCtrl) Then MsgBox(0, 'Error', 'no Treeview handle') Return SetError(2, 0, 0) EndIf WinActivate($EclipseHWND) Local $totalNoOfItems = _GUICtrlTreeView_GetCount($treeViewCtrl) If $totalNoOfItems = 0 Then MsgBox(0, 'Error', 'Treeview is empty, there are no items to expand.') Return SetError(3, 0, 0) Else _GUICtrlTreeView_Expand($treeViewCtrl, 0, False) EndIf MsgBox(0, 'Ready?', 'Script is ready to automate Eclipse''s treeview') Local $hFirstItem = _GUICtrlTreeView_GetFirstItem($treeViewCtrl) $hItem = _GUICtrlTreeView_GetNext($treeViewCtrl, $hFirstItem) _GUICtrlTreeView_EnsureVisible($treeViewCtrl, $hItem) MsgBox(0, 'Info', 'First parent is expanded.') Local $firstChildCount = _GUICtrlTreeView_GetChildCount($treeViewCtrl, $hFirstItem) MsgBox(0, 'Info', 'There are: ' & $firstChildCount & ' first level child elements.') $hItem = _GUICtrlTreeView_GetNext($treeViewCtrl, $hItem) _GUICtrlTreeView_EnsureVisible($treeViewCtrl, $hItem) MsgBox(0, 'Info', 'First child is expanded.') EndFunc
tester123 Posted August 26, 2013 Author Posted August 26, 2013 Brilliant, Thats kinda what i was looking for! Thanks. I'll try to see if I can get the text from them
Rayudu Posted September 21, 2017 Posted September 21, 2017 On 8/26/2013 at 1:36 PM, tester123 said: Brilliant, Thats kinda what i was looking for! Thanks. I'll try to see if I can get the text from them Did this actually work after 3yrs, I see this one, Wondering if Auti It has straight way to find theSWT Tree and its methods invoke without much coding?
junkew Posted September 21, 2017 Posted September 21, 2017 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
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