Forum Discussion
todd_james
12 years agoContributor
You can try mapping your objects first and then recording your script for slightly cleaner code. That being said, you will always have to go back and clean up the code it generates anyway.
Normally we try to create a name mapping structure that simplifies the items we want to access before we write/record a script.
For example, if there is a page with a table for entering customer details we would normally create an aliases for the page, ie Aliasses.CustomerDetails and then we would reorganize the name mapping file to have the controls we want to have access to right at that root level. ie txtPhoneNumber, txtFirstName, etc
Then to set the text for a field, it is clean by using Aliasses.CustomerDetails.txtFirstName.SetText("Robert");
In your case, you could likely clean up your name mapping/aliases to make it a bit cleaner but not knowing your application its tough to give specifics. For example:
Aliases.TechnologyOverview.ButtonDegree.ClickButton();
Aliases.DimensionMapView.Grid.ComboBox.ClickItem(1);
Aliases.DimensionMapView.Grid.Button.ClickButton();
You would have to give the mapped items meaningful names to make it easy to read as well. IE, if the Button in the third line is for saving name it that: SaveNewRecord
I would also look at using the Find method to locate the object on the page instead of mapping if the structure of the page is dynamic.
Being a developer originally I find it much easier and quicker to simply write the script from the start.
Normally we try to create a name mapping structure that simplifies the items we want to access before we write/record a script.
For example, if there is a page with a table for entering customer details we would normally create an aliases for the page, ie Aliasses.CustomerDetails and then we would reorganize the name mapping file to have the controls we want to have access to right at that root level. ie txtPhoneNumber, txtFirstName, etc
Then to set the text for a field, it is clean by using Aliasses.CustomerDetails.txtFirstName.SetText("Robert");
In your case, you could likely clean up your name mapping/aliases to make it a bit cleaner but not knowing your application its tough to give specifics. For example:
Aliases.TechnologyOverview.ButtonDegree.ClickButton();
Aliases.DimensionMapView.Grid.ComboBox.ClickItem(1);
Aliases.DimensionMapView.Grid.Button.ClickButton();
You would have to give the mapped items meaningful names to make it easy to read as well. IE, if the Button in the third line is for saving name it that: SaveNewRecord
I would also look at using the Find method to locate the object on the page instead of mapping if the structure of the page is dynamic.
Being a developer originally I find it much easier and quicker to simply write the script from the start.