[LDTP-Dev] How to access toolbar's button on cobra(ldtp forwindows)

Nagappan Alagappan nalagappan at zimbra.com
Mon May 28 23:24:23 PDT 2012


Hi Wang,

No problem :-)

Even sometime back, there was some update it git, thanks to John (CC) for his hard work.

Thanks
Nagappan

----- Original Message -----
From: "wangyubin" <wangyubin at cn.fujitsu.com>
To: "Nagappan Alagappan" <nalagappan at zimbra.com>
Cc: ldtp-dev at lists.freedesktop.org
Sent: Monday, May 28, 2012 11:15:55 PM
Subject: RE: [LDTP-Dev] How to access toolbar's button on cobra(ldtp forwindows)

Hi Nagappan,

> Did you compiled Cobra from source ? or from binary ? 
> Probably the binary is not up to date.

I update the source and build again, the test has been OK!! ;-)
I'm sorry to waste your time.

Thanks again.
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:wangyubin at cn.fujitsu.com
-------------------------------------------------- 
 

> -----Original Message-----
> From: Nagappan Alagappan [mailto:nalagappan at zimbra.com] 
> Sent: Tuesday, May 29, 2012 2:02 PM
> To: wangyubin
> Cc: ldtp-dev at lists.freedesktop.org
> Subject: Re: [LDTP-Dev] How to access toolbar's button on 
> cobra(ldtp forwindows)
> 
> 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" <wangyubin at cn.fujitsu.com>
> To: "Nagappan Alagappan" <nagappan at gmail.com>
> Cc: ldtp-dev at 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:wangyubin at cn.fujitsu.com
> --------------------------------------------------
> 
> 
>  
> 
> 
> ________________________________
> 
> 	From: Nagappan Alagappan [mailto:nagappan at gmail.com] 
> 	Sent: Tuesday, May 29, 2012 11:10 AM
> 	To: wangyubin
> 	Cc: ldtp-dev at 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 
> <wangyubin at 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:wangyubin at 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 at 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
> 



-- 
Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org
Cobra - Windows GUI Automation tool - https://github.com/ldtp/cobra
http://nagappanal.blogspot.com


More information about the LDTP-dev mailing list