Login Page
uri: The Uri username: The Username to login to CRM application password: The Password to login to CRM application
xrmBrowser.LoginPage.Login(_xrmUri, _username, _password);
Login(System.Uri,System.Security.SecureString,System.Security.SecureString,System.Action{Microsoft.Dynamics365.UIAutomation.Api.LoginRedirectEventArgs})
Login Page
uri: The Uri username: The Username to login to CRM application password: The Password to login to CRM application redirectAction: The RedirectAction
xrmBrowser.LoginPage.Login(_xrmUri, _username, _password, ADFSLogin);
The Dashboard page.
Switches between the DashBoard.
dashBoardName: The name of the DashBoard you want to select thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Dashboard.SelectDashBoard("Sales Performance Dashboard");
Filter by entity in the Global Search Results.
entity: The entity you want to filter with. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds
xrmBrowser.GlobalSearch.FilterWith("Account");
Searches for the specified criteria in Global Search.
criteria: Search criteria. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.GlobalSearch.Search("Contoso");
Opens the specified record in the Global Search Results.
entity: The entity you want to open a record. index: The index of the record you want to open. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.GlobalSearch.OpenRecord("Accounts",0) ;
Command bar page.
Clicks the Command
name: The Name of the command subName: The SubName moreCommands: The MoreCommands thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.CommandBar.ClickCommand("Close as Won");
Dialog page.
Closes the opportunity you are currently working on.
revenue: The revenue you want to assign to the opportunity. closeDate: The close date for the opportunity. description: The description of the closing. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Dialogs.CloseOpportunity(10000, DateTime.Now, "Testing the Close Opportunity API");
Assigns the record to a User or Team
to: The User or Team you want to assign the record to value: The value of the User or Team you want to find and select thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Dialogs.Assign(XrmDialogPage.AssignTo.Me, "");
Deletes the selected record.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Dialogs.Delete();
Checks for Duplicate Detection Dialog. If duplicate detection is enable then you can confirm the save or cancel.
save: If set to true Save the record otherwise it will cancel. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Dialogs.DuplicateDetection(true);
Run Work flow
name: The name thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Dialogs.RunWorkflow("Account Set Phone Number");
Xrm Entity page.
Opens the Entity
entityName: The Entity Name you want to open id: The Guid thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.OpenEntity(TestSettings.AccountLogicalName, Guid.Parse(TestSettings.AccountId));
Opens the Entity
uri: The uri thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.OpenEntity(item.Url);
Navigate Down the record
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.NavigateDown();
Navigate Up the record
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.NavigateUp();
Selects the Form
name: thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.SelectForm("Details");
Selects the tab and clicks. If the tab is expanded it will collapse it. If the tab is collapsed it will expand it.
name: The name of the tab.
xrmBrowser.Entity.SelectTab("Summary");
Collapses the Tab on a CRM Entity form.
name: The name of the Tab.
xrmBrowser.Entity.CollapseTab("Summary");
Expands the Tab on a CRM Entity form.
name: The name of the Tab.
xrmBrowser.Entity.ExpandTab("Summary");
Set Lookup Value for the field
field: The Field index: The Index
xrmBrowser.Entity.SelectLookup("customerid", 0);
Set Lookup Value for the field
field: The Field value: The Value
xrmBrowser.Entity.SelectLookup(TestSettings.LookupField, TestSettings.LookupName);
Set Lookup Value for the field
field: The Field openLookupPage:
Popout the form
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.Popout();
Click add button of subgridName
subgridName: The SubgridName thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.ClickSubgridAddButton("Stakeholders");
Click GridView button of subgridName
subgridName: The subgridName thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Set Lookup Value for Subgrid subgridName
subgridName: The SubgridName value: thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.SelectSubgridLookup("Stakeholders", "Alex Wu");
Set Lookup Value for Subgrid
subgridName: The subgridName index: The Index
xrmBrowser.Entity.SelectSubgridLookup("Stakeholders", 3);
Set Lookup Value for Subgrid
subgridName: The SubgridName openLookupPage: The Open Lookup Page
xrmBrowser.Entity.SelectSubgridLookup("Stakeholders", true);
Closes the current entity record you are on.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.CloseEntity();
Saves the specified entity record.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Entity.Save();
Xrm Grid Page
Switches the view.
viewName: Name of the view. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.SwitchView("Open Opportunities");
Refreshes this instance.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.Refresh();
Firsts the page.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.FirstPage();
Nexts the page.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.NextPage();
Toggles the select all.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.SelectAllRecords();
Previouses the page.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.PreviousPage();
Opens the chart.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.OpenChart();
Closes the chart.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.CloseChart();
Pins this instance.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.Pin();
Searches the specified search criteria.
searchCriteria: The search criteria. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.Search("Test API");
Sorts the specified column name.
columnName: Name of the column. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.Sort("Account Name");
Gets the grid items.
var items = xrmBrowser.Grid.GetGridItems().Value;
Opens the grid record.
index: The index. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.OpenRecord(0);
Selects the grid record.
index: The index of the row you want to select. Index starts with 0. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.SelectRecord(1);
Filters the by letter.
filter: The filter. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.FilterByLetter('A');
Filters the by all.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.FilterByAll();
Opens the filter.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.EnableFilter();
Switches the chart on the Grid.
chartName: Name of the chart. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Grid.SwitchChart("Accounts by Owner");
Xrm Guided Help Page
Closes the Guided Help
xrmBrowser.GuidedHelp.CloseGuidedHelp();
Xrm Lookup Page
Switch Entity
entityName: The Entity Name thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Switches the view
viewName: The ViewName thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Selects the Item
index: The Index thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Lookup.SelectItem(0);
Selects Item based on the value given
value: The value thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Lookup.SelectItem("Alex Wu");
Add Lookup
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Lookup.Add();
Select from subgrid
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Lookup.Select();
The Xrm Navigation page.
Opens the home page
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenHomePage();
Opens the Sub Area
area: The area you want to open subArea: The subarea you want to open thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenSubArea("Sales", "Opportunities");
Opens the Related Menu
relatedArea: The Related area thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenRelated("Cases");
Global Search
searchText: The SearchText thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.GlobalSearch("Contoso");
Open the Advanced Find
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenAdvancedFind();
Open Quick Create
entity: The entity name thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.QuickCreate("Account");
SignOut
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.SignOut();
Opens the Guided Help
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenGuidedHelp();
Opens the Admin Portal
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenAdminPortal();
Opens the Options
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenOptions();
Opens the print preview
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenPrintPreview();
Open Apps for Dynamics
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenAppsForDynamicsCRM();
Opens Welcome Screen from navigation bar
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenWelcomeScreen();
Opens About from navigation bar
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenAbout();
Opens OptOut Learning Path
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenOptOutLearningPath();
Opens the Privacy Statement
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Navigation.OpenPrivacyStatement();
Business process flow.
Moves to the Next stage in the Business Process Flow.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.BusinessProcessFlow.NextStage();
Moves to the Previous stage in the Business Process Flow.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.BusinessProcessFlow.PreviousStage();
Hides the Business Process flow UI.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.BusinessProcessFlow.Hide();
Selects the Business Process Flow stage.
stagenumber: The stage number that you would like to select. The stages start with 0. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.BusinessProcessFlow.SelectStage(0);
Sets the current selected Stage as Active.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.BusinessProcessFlow.SetActive();
Selects the Business Process Flow from the Dialog.
name: The name of the business process flow you want to select. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.BusinessProcessFlow.SelectBusinessProcessFlow("Opportunity Saless Process Alt");
Xrm Notfication Page
Closes the Notifications
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Notifications.CloseNotifications();
Xrm Quick Create Page
Initializes a new instance of the class.
browser: The browser.
Cancel the Quick Create Page
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.QuickCreate.Cancel();
Save the Quick create page
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.QuickCreate.Save();
Set Lookup Value for the field
field: The Field Value index: The Index
xrmBrowser.QuickCreate.SelectLookup("primarycontactid", 0);
Sets the value of a Checkbox field.
field: Field name or ID. check: If set to true [check].
Sets the value of a Date Field.
field: The field id or name. date: DateTime value.
Sets the value of a Text/Description field.
field: The field id. value: The value.
xrmBrowser.QuickCreate.SetValue("name", "Test API Account");
Sets the value of a Field.
field: The field .
Sets the value of a picklist.
option: The option you want to set.
Sets the value of a Composite control.
control: The Composite control values you want to set.
Activity feed page.
Selects the tab.
tabname: The Tabname. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.ActivityFeed.SelectTab(Api.Pages.XrmActivityFeedPage.Tab.Activities);
Adds Notes to the activity feed
noteText: The NoteText thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.ActivityFeed.AddNote("Test Add Note");
Adds Post to the activity feed
postText: The postText thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.ActivityFeed.AddPost("Test Add Post");
FilterActivitiesByStatus(Microsoft.Dynamics365.UIAutomation.Api.Pages.XrmActivityFeedPage.Status,System.Int32)
Filters Activities by Status
status: The Status thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Opens Activities Associated View
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Adds PhoneCall to the activity feed
description: The description leftVoiceMail: The leftVoiceMail outgoing: The outgoing thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.ActivityFeed.AddPhoneCall("Test Phone call Description",false);
AddTask(System.String,System.String,System.DateTime,Microsoft.Dynamics365.UIAutomation.Api.OptionSet,System.Int32)
Adds task to the activity feed
subject: The subject description: The description dueDate: The dueDate priority: The priority thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Adds Email to the activity feed
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.ActivityFeed.AddEmail();
Adds Appointment to the activity feed
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.ActivityFeed.AddAppointment();
Xrm Related Grid Page
Switches from one view to another
viewName: Name of the view to which you want to switch thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Related.SwitchView("Active Cases");
Refresh
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Firsts the page.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Nexts the page.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Toggles the select all.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Previouses the page.
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Searches the specified search criteria.
searchCriteria: The search criteria. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Related.Search("F");
Sorts the specified column name.
columnName: Name of the column. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Related.Sort("createdon");
Get the Grid Items
thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
Opens the grid record.
index: The index. thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Related.OpenGridRow(0);
Clicks the Command
name: The name subName: The subName moreCommands: The moreCommands thinkTime: Used to simulate a wait time between human interactions. The Default is 2 seconds.
xrmBrowser.Related.ClickCommand("ADD NEW CASE");
Xrm Page
Sets the value of a Checkbox field.
field: Field name or ID. check: If set to true [check].
xrmBrowser.Entity.SetValue("creditonhold",true);
Sets the value of a Date Field.
field: The field id or name. date: DateTime value.
xrmBrowser.Entity.SetValue("birthdate", DateTime.Parse("11/1/1980"));
Sets the value of a Text/Description field.
field: The field id. value: The value.
SetValue(Elements.ElementId[Reference.Dialogs.CloseOpportunity.ActualRevenueId], revenue.ToString());
Sets the value of a picklist.
option: The option you want to set.
xrmBrowser.Entity.SetValue(new OptionSet {Name = "preferredcontactmethodcode", Value = "Email"});
Sets the value of a Composite control.
control: The Composite control values you want to set.
xrmBrowser.Entity.SetValue(new CompositeControl() { Id = "fullname", Fields = fields });
Sets the value of a Lookup.
control: The lookup field name, value or index of the lookup.
this.SetValue(new Lookup() { Name = Elements.ElementId[Reference.Dialogs.Assign.UserOrTeamLookupId], Value = value });
Gets the value of a Text/Description field.
field: The field id.
string mobilePhone = xrmBrowser.Entity.GetValue("mobilephone");
Gets the value of a Composite control.
control: The Composite control values you want to set.
string fullName = xrmBrowser.Entity.GetValue(new CompositeControl() { Id = "fullname", Fields = fields });
Gets the value of a picklist.
option: The option you want to set.
string options = xrmBrowser.Entity.GetValue(new OptionSet { Name = "preferredcontactmethodcode"});
Gets the value of a Lookup.
control: The lookup field name, value or index of the lookup.
string lookupValue = xrmBrowser.Entity.GetValue(new Lookup { Name = "primarycontactid" });
The XRM Document Page that provides methods to interact with the browswer DOM.
Returns the document element that has the ID attribute with the specified value.
id: The identifier.
Returns the document element that has the CSS attribute with the specified value.
css: The CSS.
Returns the document element that has the specified XPath value.
xpath: The xpath that is used to references nodes in the document.