Forum Discussion
Hopefully this will help... at least I'm now able to interact with Combox Control.
1). In the TestLeft project, you will need to initialize the ObjectMapping for the QT controls:
public static void ConfigureTestLeftOptions()
{
//
//https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/mapping.html
//
// List of QT Controls that can be mapped:
// Calendar widget, Combo box, Check box, Menu, Scroll bar, Tab widget, Spin box, Tool button, Line edit, Radio button, Push button, Text edit, Tree widget, Date - time edit, Double spin box, Slider, Menu bar, Table widget, List widget.
driver.Options.ObjectMapping["Qt Controls"]["List widget"].AddClassName("ZSqlListView");
driver.Options.ObjectMapping["Qt Controls"]["List widget"].AddClassName("drop_list");
driver.Options.ObjectMapping["Qt Controls"]["Table widget"].AddClassName("CadListView");
driver.Options.ObjectMapping["Qt Controls"]["Combo box"].AddClassName("ZSqlComboBox");
driver.Options.ObjectMapping["Qt Controls"]["Combo box"].AddClassName("ZSqlValueComboBox");
. . .
}
2) Using the ISpyTool navigate to the Combobox
Then Rt. Click and select Copy Identification
3) Using the logic from Copy Identification set up a method to derive the object:
For Example: (Notice need to CAST to the correct Object Type)
private IComboBox Control_CFSLogCboPresets(IDriver driver, int iCustomTimeout = 5000)
{
IComboBox iControl = driver.Find<IProcess>(new ProcessPattern { ProcessName = "leds" })
.Find<ITopLevelWindow>(new QtPattern() { QtClassName = "CoreMainWindow", QtText = "CentralSquare Public Safety Suite Professional", Index = 1 })
.Find<IControl>(new QtPattern() { QtClassName = "CoreWindow", QtText = "", QtIndex = 1 })
.Find<IControl>(new QtPattern() { QtClassName = "ScreenPane", QtText = "", QtIndex = 1 })
.Find<IControl>(new QtPattern() { QtClassName = "ZScreenContainer", QtText = "", QtIndex = 2 })
.Find<IControl>(new QtPattern() { QtClassName = "ZScrollView", QtText = "", QtIndex = 1 })
.Find<IControl>(new QtPattern() { objectName = "qt_scrollarea_viewport" })
.Find<IControl>(new QtPattern() { QtClassName = "QFrame", QtText = "", QtIndex = 1 })
.Find<IControl>(new QtPattern() { objectName = "CFSLog_scr" })
.Find<IControl>(new QtPattern() { objectName = "zdrDateRange" })
.Find<IComboBox>(new QtPattern() { objectName = "cboPresets" },
1, iCustomTimeout); //Level and Timeout value
return iControl;
}
4. Derive the object and the variable will look something like:
(note this screen shot is after the combobox has been selected)
5. Select an item in the Combobox:
// Derive the object
var controlCboCommand = _commonInterface.DeriveControl(_pageCfsLogInterface.FuncDeriveControlCFSCboCommand);
// Select 'ASSIGN' in the combobox
controlCboCommand.ClickItem("ASSIGN");
Related Content
- 2 years ago
Recent Discussions
- 8 hours ago
- 2 days ago