Ranorex 8.3.1: How to Click on the Icon in the Notification Area using C#

Class library usage, coding and language questions.
yyliu
Posts: 4
Joined: Tue Dec 11, 2018 6:32 am

Ranorex 8.3.1: How to Click on the Icon in the Notification Area using C#

Post by yyliu » Thu Dec 20, 2018 7:24 am

Hi,
As one of the automated test for a Windows program, I need to click on a program icon and select one of the menu item.
For example, in the screenshot below, there is an icon "Safely Remove and Eject Media", I need to click on this icon.
NotificationArea.JPG
NotificationArea.JPG (14.41 KiB) Viewed 1601 times
Then click on the menu "Open Devices and Printers" as shown in the screen shot below
NotificationArea2.JPG
NotificationArea2.JPG (48.42 KiB) Viewed 1601 times
This should open up the Windows form "Devices and Printers"

How can I automate this test in Ranorex 8.3.1 using C# for Windows 10 and Windows 7?
Please show me code snipplets in C#.

I've looked through these articles but the code don't work for Ranorex 8.3.1
Trouble accessing Windows notification tray area.
viewtopic.php?f=13&t=96&p=263&hilit=Not ... +Area#p263

Navigating task tray icon context menus
navigating-task-tray-icon-context-menus-t124.html

Thank you for your help.

User avatar
RobinHood42
Posts: 306
Joined: Fri Jan 09, 2015 3:24 pm

Re: Ranorex 8.3.1: How to Click on the Icon in the Notification Area using C#

Post by RobinHood42 » Fri Dec 21, 2018 9:08 am

Hi,

All of those items are easily trackable with Ranorex Spy, so there is no need to create user code.

Hint: Use F12 to pause the tracking of Ranorex Spy, this allows you to track context menus.

If you aren’t able to automate that scenario you could simply us the cmd to open the “Devices and printers”

CMD.png
CMD.png (5.57 KiB) Viewed 1568 times
Cheers,
Robin

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5163
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex 8.3.1: How to Click on the Icon in the Notification Area using C#

Post by odklizec » Fri Dec 21, 2018 9:53 am

Hi,

Agree with Robin. The less code you create, the more reliable your test will be in a long run. There is really no need to code everything.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration