Forum Discussion

jloyzagawh's avatar
jloyzagawh
Contributor
9 years ago

Recording in C# script possible?

I am recording a script and I've changed the native language to C# script yet when it records it gives me this code - how can I get it to convert/record in C# script?

function Test1()
{
var hwndSource;
var tabControl;
var grid;
var grid2;
var masterSearchPanel;
var listBox;
var itemsControl;
var searchTab;
TestedApps.SportingBet_Intrabet.Run();
hwndSource = Aliases.SportingBet_Intrabet.HwndSource_IntrabetMainWindow;
tabControl = hwndSource.IntrabetMainWindow.Grid.Grid.windows;
tabControl.ClickTab("Event Management");
grid = tabControl.eventManagement.grdMain;
grid2 = grid.EventStack.Grid.Grid.Grid;
masterSearchPanel = grid2.masterSearchPanel;
masterSearchPanel.Grid.lbSearchResults.ClickItem(3);
listBox = grid2.Grid.CurrentSearchPanel.Grid.Grid.lbSearchResults;
listBox.ListBoxItem4.EventSearchResultView.Click(388, 8);
listBox.ListBoxItem2.EventSearchResultView.Click(402, 12);
grid.Grid.tabControl.ScrollViewer.Grid.contentEventSummary.Grid.Grid.StackPanel.pnlLinks.ItemscontrolLinks.ContentPresenter.Button.ClickButton();
itemsControl = grid2.lbFurtherSearches;
searchTab = itemsControl.ContentPresenter2.Grid.searchTab;
searchTab.Click(10, 91);
searchTab.Click(24, 60);
itemsControl.ContentPresenter.Grid.searchTab.Click(21, 75);
masterSearchPanel.Click(19, 46);
tabControl.ClickTab("Dashboard");
hwndSource.Close();
}

4 Replies

  • leandropoblet's avatar
    leandropoblet
    Frequent Contributor

    Have you tried creating a new project this time using C# as default script language and then recording?

    Does it come with the same output?

  • cunderw's avatar
    cunderw
    Community Hero

    If you created the project with Jscript you will not be able to just change the default and have it work in that project. You will have to create a new project with C# as it's language. 

  • You could also change the default to C~Script in Tools >Options >General >Project and then record your script.

     

    Regards

    Damien

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    My 2 cents J

    Jloyzagawh, you need to create a C# project. In this case, TestCompete will record scripts by using this script language. If you have already recorded many scripts with JScript, there is no need to re-record them. C#Script and JScript languages use the same engine. Thus, C# projects can execute JScript tests.