[LDTP-Dev] Select element in system tray (Windows 7) using WDTP
Nagappan Alagappan
nagappan at gmail.com
Sun Apr 22 20:28:46 PDT 2012
Hello,
There was a question from my colleague, how do I select an element from
system tray icon in Windows 7. I came up with the following code:
from ldtp import *
s=getobjectsize('pane0', 'btnNotificationChevron')
generatemouseevent(s[0] + s[2]/2, s[1] + s[3]/2, 'b1c')
wait(2)
s1=getobjectsize('paneNotificationOverflow', 'btnMcAffee*')
generatemouseevent(s1[0] + s1[2]/2, s1[1] + s1[3]/2, 'b3c')
wait(2)
getobjectlist('mnuContext')
selectmenuitem('mnuContext', 'mnuVirusScanConsole')
He asked me how do get to identify these objects, when I use UI Automation
Verify <http://uiautomationverify.codeplex.com/>, I could not identify the
object as the icon in sys tray disappears after I select something in the
tool.
I explained him this what I did to find the object in a python prompt:
First used getojbectlist('pane0') to verify whether its the bottom panel
and noticed 'Start' button was part of the output.
Tried clicking all the objects one by one in the tray icon to see which one
has all the hidden app icons and found 'Notification Chevron' button.
He asked me why do you use s[0] + s[2] / 2 ... I explained as: to click on
the center of the widget, get the object size (x, y, width, height) then do
x + width / 2, y + height / 2 and get the center point on the object and do
left click (b1c).
Once the app icons popup do right click on the object, which pops up the
menu.
Next question from him was, how did you found 'mnuContext' as the window
name ?
I did getwindowlist() before right clicking the object and after that as
well, with that I found one additional window name in the list which is
'mnuContext'.
Now you are all set for selecting the element from sys tray icon.
Thanks
Nagappan
--
Linux Desktop (GUI Application) Testing Project -
http://ldtp.freedesktop.org
http://nagappanal.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/ldtp-dev/attachments/20120422/0757c184/attachment.html>
More information about the LDTP-dev
mailing list