Ask a Question

selecting an option from multiple submenuoptions.

msap
Frequent Contributor

selecting an option from multiple submenuoptions.

Hi

 

when I run below Script ,  script does not select option(  Export... \excel.. \new workbook) from multiple menu options. just stops .

 

Could you please let me know what I am missing here.

 

Aliases.Framework.DividendEditorForm.splitContainerControl1.SplitGroupPanel2.accrualGrid.XtraPopupMenu.Click("Export...|Excel...|New Workbook");

 

gives below Error

 


System.InvalidCastException: Unable to cast COM object of type 'System.__Com Object' to class type 'System.Reflection.MemberInfo'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
   at SmartBear.TestComplete12.Hook.MarshalHelper.CastIUnknownToMemberInfo(Object obj).

 
 

 

Thanks 

6 REPLIES 6
Marsha_R
Community Hero

Not sure what that error is, but what are you trying to accomplish in Excel?  Maybe we can find you an easier way to do it.


Marsha_R
[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
msap
Frequent Contributor

yes there is an export to excel via new workbook in three different sub-menu option in the grid. Could you please let me know. in the previous post there is an attachment. 

tristaanogre
Esteemed Contributor

My question: Why are you automating the UI of Excel?  If you need to manipulate an Excel file, including exports and such, you can access Excel via the COM object for the Excel.Application. https://support.smartbear.com/testcomplete/docs/testing-with/advanced/working-with-external-data-sou...

 

What is your ultimate end goal in your test that you are writing?  The error you're getting sounds like it's coming directly from TestComplete... you might need to contact support directly for that.  However, if your test doesn't EXPLICITLY need to interact with the Excel application but only needs to manipulate the file, you would probably benefit from some other methodology.

 

 


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
msap
Frequent Contributor

Hi Martin

All I need to do is to: I need to export to excel using the menu option available from the application grid.

Thanks 

tristaanogre
Esteemed Contributor

I'm assuming, though, that you are not a QA engineer/Test Automation engineer on the Microsoft Office development team and so do not actually have a need to test the ability to export an excel workbook into some other format.  I understand that you want to manipulate the UI of Excel.... but unless you're actually testing Excel, there MAY be a different way to reach your end goal.  

 

Regardless... what you have in your initial code for the Click on the menu is correct... but the error is not something that is a coding problem with your automation code but something a little lower level in the TestComplete code itself.  In that case, you should open a ticket at https://support.smartbear.com/message/?prod=TestComplete.

 

HOWEVER, as indicated in my opening paragraph... if your end goal is simply to take an Excel file and export it to a different format, you can follow the link I put up earlier about manipulating Excel via COM.


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

Yes.  What @tristaanogre said is right, and that's why I asked what you were using Excel for in the first place.  If we know what you are trying to do with this worksheet, there are other ways around it.  Trying to automate Excel (or any other "outside" software) can be a big waste of your time.  


Marsha_R
[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: