Forum Discussion

googleid_105206's avatar
googleid_105206
Contributor
14 years ago

which is better way to handle context menus in IE and Firefox browser?



Hi,

I am Working on Flex4.5 based application using testcomplete 8.6.How handle context menus . Below example code is working correctly ,please correct me.which is the better way to  to handle this type objects.



Fire Fox Browser:

1)set
contexMenu=Sys.Process("firefox").Window("MozillaUIWindowClass",
"Mozilla Firefox", 1).Window("MozillaWindowClass",
"", 1).Window("MozillaContentWindowClass", "",
1).Window("MozillaWindowClass", "",
1).Window("MozillaWindowClass", "", 1)    


contexMenu.PopupMenu.Click("EditCopyBlock")   // using this
way it's working fine

                                      
or

 set
contexMenu=Sys.Process("firefox").Window("*").FindChild("WndClass","MozillaWindowClass",10)

     contexMenu.PopupMenu.Click("EditCopyBlock") 
// using this child method i get Ambiguous window



IE Browser:

set contexMenu=Sys.Process("IEXPLORE", 3).IEFrame(0).Window("Frame Tab", "", 1).Tab("http://172.16/ - Windows Internet Explorer").Window("Shell DocObject View", "", 1).Window("Internet Explorer_Server", "", 1).Window("MacromediaFlashPlayerActiveX", "", 1)

 contexMenu.PopupMenu.Click("EditCopyBlock")  // using this
way it's working fine





Please suggest me which is better approach to handle Context menus IE and Fire Fox.



Regards

Vijay










  • Hi,


    To address the tested objects in your test, you use the fully-qualified names which include the object name and the names of all of their parent objects. However, this approach is not reliable since the names of web elements can change between different test run sessions or even during the same session. The best way to address the tested objects is to use Name Mapping. This feature allows you to map web objects to custom (short and more readable) names and specify values that identify each of these objects on the web page. For more information, please read Name Mapping in the online documentation.


    As for the FindChild method you are using, it returns the ambiguous window as you search for the objects whose WndClass property is MozillaWindowClass, but there are more than one of such objects. Try using another property for the search, for example, WndCaption.