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

wangyubin wangyubin at cn.fujitsu.com
Mon May 28 22:18:15 PDT 2012


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
	

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testToolbar.zip
Type: application/octet-stream
Size: 25241 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/ldtp-dev/attachments/20120529/6be916e2/attachment-0001.obj>


More information about the LDTP-dev mailing list