Hi Wang, >>> win_name = "frmtestToolbar" >>> print getobjectlist(win_name) ['ukn0', 'mnuSystem', 'mnuSystem1', 'btnMinimize', 'btnMaximize', 'btnClose', 'tbar0', 'btn3', 'ukn1', 'btnfo', 'btnfa', 'btnfc', 'tbar1', 'btn7', 'ukn2', 'btnf1', 'btnf2', 'btnf3'] >>> #result ["tbar0", "tbar1" ......] ... >>> tbar0 = "tbar0" >>> tbar1 = "tbar1" >>> print getchild(win_name, tbar0) ['btnfc', 'ukn0', 'btnfa', 'btnfo', 'btn0'] >>> # result ["btnfo", "btnfa", "btnfc"......] ... print getchild(win_name, tbar1) ['ukn0', 'btnf2', 'btn0', 'btnf3', 'btnf1'] >>> # result ["btnf1", "btnf2", "btnf3"......] ... >>> print getobjectinfo(win_name, "btnf1") ['label', 'key', 'obj_index', 'class', 'parent', 'children'] >>>
I tried this on python prompt, and it worked perfectly fine. Did you compiled Cobra from source ? or from binary ? Probably the binary is not up to date. Thanks Nagappan ----- Original Message ----- From: "wangyubin" <wangyu...@cn.fujitsu.com> To: "Nagappan Alagappan" <nagap...@gmail.com> Cc: ldtp-dev@lists.freedesktop.org Sent: Monday, May 28, 2012 10:18:15 PM Subject: Re: [LDTP-Dev] How to access toolbar's button on cobra(ldtp for windows) Hi Nagappan, I create a simple wpf application to reproduce this issue. I have used sharpdevelop4.x to create this appliction. Unzip testToolbar.zip, in the bin/Debug directiory there is the app for test. my python code is: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from ldtp import * import time launchapp("d:\\testToolbar.exe") time.sleep(3) print getwindowlist() win_name = "frmtestToolbar" print getobjectlist(win_name) #result ["tbar0", "tbar1" ......] tbar0 = "tbar0" tbar1 = "tbar1" print getchild(win_name, tbar0) # result ["btnfo", "btnfa", "btnfc"......] print getchild(win_name, tbar1) # result ["btnf1", "btnf2", "btnf3"......] print getobjectinfo(win_name, "btnf1") # Exception: Exception: Unable to find Object info: btnf1 raw_input("Press any key to exit!") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PS. I put the testToolbar.exe in "D:\ " when I runned this test I don't know how to click the button(such as "btnfo", "btnfc" etc.) in the toolbar. Thanks wang yubin -------------------------------------------------- wang yubin Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST) No. 6 Wenzhu Road, Nanjing, 210012, China TEL:+86-25-86630566-8516 FUJITSU INTERNAL:7998-8551 FAX:+86+25-83317685 EMail:wangyu...@cn.fujitsu.com -------------------------------------------------- ________________________________ From: Nagappan Alagappan [mailto:nagap...@gmail.com] Sent: Tuesday, May 29, 2012 11:10 AM To: wangyubin Cc: ldtp-dev@lists.freedesktop.org Subject: Re: How to access toolbar's button on cobra(ldtp for windows) Hi Wang, You are the first customer to use Cobra outside VMware ;-) (atleast I know) Can you please provide me a generic app with which I can reproduce this bug ? Thanks Nagappan On Mon, May 28, 2012 at 7:14 PM, wangyubin <wangyu...@cn.fujitsu.com> wrote: Hi, Nagappan I want to use cobra to create my automatic test cases. but I found there is no APIs to access toolbar. please help me how to access the icon button which is in the toolbar. my code : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ getobjectlist("frmMainWindow") # result ["tbar0", "tbar1".......] getchild("frmMainWindow", "tbar0") # result ["btn1", "btn0", "btn2"......] getchild("frmMainWindow", "tbar1") # result ["btn2", "btn3", "btn0"......] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ when I try to access "btn0", "btn1" and so on, an Exception will pop up. my code : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ getobjectinfo("frmMainWindow", btn1) Exception: Unable to find Object info: btn1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Thanks wang yubin -------------------------------------------------- wang yubin Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST) No. 6 Wenzhu Road, Nanjing, 210012, China TEL:+86-25-86630566-8516 FUJITSU INTERNAL:7998-8551 FAX:+86+25-83317685 EMail:wangyu...@cn.fujitsu.com -------------------------------------------------- -- Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra http://nagappanal.blogspot.com _______________________________________________ LDTP-dev mailing list LDTP-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/ldtp-dev -- Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra http://nagappanal.blogspot.com _______________________________________________ LDTP-dev mailing list LDTP-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/ldtp-dev