Ask a Question

Problem with perform click operation on PopupMenu

deshmukh
New Contributor

Problem with perform click operation on PopupMenu

I am using jscript 
I want to perform click opearation on PopupMenu object but its giving Error like PopupMenu is null or not an object

Object Properties values are -
Exists -True

Enabled - True

Name - WPFObject("Popup")

Visible - False

VisibleOnScreen - False

PopupMenu - null

I tried adding delay and waitProperty to wait until objects becomes visible on screen but not worked 😞 


Any suggestions are welcome ..

Thanks in advance πŸ™‚

10 REPLIES 10
tristaanogre
Esteemed Contributor

More information, please.  

 

Can you give the actual code that you're using?  Are you using NameMapping to find the object?  Can you give us a screenshot of the Object Browser showing the object in question with properties, hierarchy, etc? 

My guess:

 

Popupmenus are not recognized in TestComplete as objects to be "found" and interacted with.  They are properties on an object that allow a "Click" methodology.

 

See https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/po...

 

So, what you SHOULD do is have your parent object use that property as indicated in the documentation above.  Something like

 

parentObject.PopupMenu.Click("MenuItem")

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

I am not using Name mapping 

tristaanogre
Esteemed Contributor

OK, then your code should be

WPFObject('Tbutton').Click()
WPFObject('Tbutton').PopupMenu.Click("Menu Item")




Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Well , I tried but it doesnt work , giving Error : PopupMenu is null or not an object
Development Hierarchy shown as below :
image (4).png

tristaanogre
Esteemed Contributor

The code of the AUT doesn't help.  Please provide the code you are actually executing in TestComplete.  We'll need that to determine what's going wrong.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sonya_m
SmartBear Alumni (Retired)

Thanks tristaanogre!

 

@deshmukh Is this possible to provide the actual code? That would help the Community to try and troubleshoot!


Sonya Mihaljova
Community and Education Specialist

Provided code in Private Message , Plz have a look

 

 

Thanks πŸ™‚

tristaanogre
Esteemed Contributor

I'm coping the code that I received via PM here so that the whole community can contribute to solution.

 

function commit() {

var umprocess =Sys.Process("Simplivity.UpgradeManager.View");

var tButton = umprocess.WPFObject("HwndSource: Shell", "HPE SimpliVity Upgrade Manager").WPFObject("Shell", "HPE SimpliVity Upgrade Manager", 1).WPFObject("RootGrid").WPFObject("ContainerView", "", 1).WPFObject("Grid", "", 1).WPFObject("ContentPresenter", "", 1).WPFObject("FederationView", "", 1).WPFObject("Grid", "", 1).WPFObject("radTreeListView").WPFObject("TreeListViewRow", "", 4).WPFObject("GridViewCell", "", 3).WPFObject("Grid", "", 1).WPFObject("Border", "", 1).WPFObject("Grid", "", 1).WPFObject("Tbutton")
tButton.Click();
aqUtils.Delay(200000);

var CommitMenu = tButton.PopupMenu
if(CommitMenu != null)
{
CommitMenu.Click();
}
}

 

Now that we have that code... where exactly does the error occcur?  On which line of the code?

 

Also, note that clicking on a popup menu, as per the documentation that I provided earlier, requires you to indicate WHAT item on that menu you're clicking. 

 

Another suggestion....  have you tried recording the steps?  It might be that what we think is the proper popup menu isn't the right one.  If you record a simple script with interaction with the components you want, that should show better what's going on.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

@deshmukh :

 

tButton.Click();
aqUtils.Delay(200000);

var CommitMenu = tButton.PopupMenu

PopupMenu well may be not a child of the tButton object, but a child of some other window. Try to highlight it using Object Spy in the Point-And-Fix mode and check the hierarchy for the given popup menu object.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β