1、TestComplete提供了已经编译好的Flex界面,可以直接使用:
http://support.smartbear.com/samples/testcomplete9/flex/orders.html
打开即可测试。
2、TestComplete已经有了写好的代码,位于TestComplete 9 Samples\Open Applications\Flex下,
其中有多种语言编写的代码,可以参考。
使用tc打开工程,可以直接运行。
但是这里面的代码已经做过了namemapping,所以如果要拷贝出来用,还有点问题。
3、
----------
function AddNewOrder(Orders) { var editorder; //Orders.OrdersPanel.Buttonbar.NewOrder.ClickButton(); Orders.orders("orders").ButtonBar("Bar").ButtonBarButton("New Order").ClickButton(); //editorder = Orders.Editorder; editorder = Orders.editorder("Edit Order") //editorder.ComboboxProduct.ClickItem("FamilyAlbum"); editorder.ComboBox("Product").ClickItem("FamilyAlbum"); //editorder.EditQuant.Textinput.FlexObject.text = "4"; editorder.NumericStepper("edit_quant").TextInput(0).FlexObject.text = "4"; //editorder.EditDate.TextInput.FlexObject.text = aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%d/%m/%y"); editorder.DateField("edit_date").TextInput(0).FlexObject.text = aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%d/%m/%y"); //editorder.EditDateex.TextInput.FlexObject.text = aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Today(), 1), "%d/%m/%y"); editorder.DateField("edit_dateex").TextInput(0).FlexObject.text = aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Today(), 1), "%d/%m/%y"); //editorder.EditCname.FlexObject.text = "John Black"; editorder.TextInput("CustomerName").FlexObject.text = "John Black"; //editorder.EditStreet.FlexObject.text = "Light street"; editorder.TextInput("edit_street").FlexObject.text = "Light street"; editorder.TextInput("edit_city").FlexObject.text = "Rain city"; editorder.TextInput("edit_state").FlexObject.text = "US"; editorder.TextInput("edit_zip").FlexObject.text = "123456"; editorder.RadioButton("VISA").ClickButton(); editorder.TextInput("edit_cardnr").FlexObject.text = "1324354657"; editorder.Button("btnOk").ClickButton(); } function Main() { var page, URL, Orders; URL = "http://support.smartbear.com/samples/testcomplete9/flex/orders.html"; Browsers.Item(btIExplorer).Run(URL); //TestedApps.iexplore.Run(); //Browsers.Item(btIExplorer).Navigate(URL); page = Aliases.browser; page.pageOrders.Wait(); Orders = page.Page(URL).Object("orders"); // AddNewOrder(Orders); EditOrder(Orders, 6); //LogRow(Orders.OrdersPanel.DataGrid, 6); //DeleteOrder(Orders, 9); // page.BrowserWindow.Close(); }
---------------