Problem calling method of custom qt object with QMetaObject::invokeMethod
Hi Everyone, I am testing a Qt application with Test Complete, my context is : Application compiled with Qt 5.9.5 + MSVC 2015 64 bit Test Complete 12.50 with VBScript language In this example case, my application is only a QWidget with a QPushButton. When clicking on this button, a custon menu appears. This menu is a class CMenu, derived from QMenu CMenu is declared in object mapping under Qt Controls > Menu in Test Complete project properties (default and current) My need is : access some data of my CMenu. These data are in a QList<QString> private member of my CMenu class. So, I declared a public accessor in my class to get one item of my list by its index in the list. ... class CMenu : public QMenu { Q_OBJECT private: QList<QString> m_lstTestNames; public: ... Q_INVOKABLE QString getTestName(int index) const; ... }; ... QString CMenu::getTestName(int index) const { return this->m_lstTestNames.at(index); } It works fine, in the object browser of Test Complete, I found my object and this method Sys.Process("proto_cmenu").QtObject("CMenu", "", 1).getTestName Description : Function getTestName(Param1 as Integer) as Object Now I want to use this method in my test script. So, first I open my application and I click on the push button to display my menu, and then call my method like below for example(it's the line 46 of my script) : Log.Message "Test Name 0 = " & Sys.Process("proto_cmenu").QtObject("CMenu", "", 1).getTestName(0) My problem is : I got the following error : VBScript runtime error. Erreur non spécifiée Error location: Unit: "FELIX\FLX_TST_007\Script\MAIN" Line: 46 Column: 2. With the following message just above in the log : Debug String: QMetaObject::invokeMethod: No such method CMenu::getTestName(getTestName) Candidates are: getTestName(int) I don't understand this message, as you see above, I called my function with an integer in my script, why does it talk me about "CMenu::getTestName(getTestName)" ? Can someone give me some help to go through this problem ?1.5KViews0likes2CommentsThe window was destroyed during method execution.
A weird error appears when i start my network-suite-jobs. After opening the application on the remote machine, testcomplete/testexecute should press a button on the main menu, but then it stops the testing (from my sight without a reason). The strange thing is, that this is happening randomly - sometimes everything works fine, but from time to time this weird error comes up (only on two from ten tests): "The window with the handle 0x0001042e does not exist. Most likely, this error occurred because the tested object (window or control) or its parent object was deleted or recreated during the method call or before it. For instance, the window could be destroyed or recreated after you stored the object reference to a variable and before you called the object method through this variable. If the object is recreated, then to avoid the error, check the object's Exists property before calling the method, and if the object does not exist, obtain a reference to the new object." Tested object: Aliases.xxx.DesignPointDlg_Gas_Comp (Sys.Process('xxx').VCLObject('DesignPointDlg'))Solved4.8KViews0likes3Comments