User Review
( votes)Introduction
Easyrepro has given us an easy way of UI Automation testing for Dynamics 365 CRM. There are many functions related to Command bar, which makes clicking any button on the Command bar easy.
In this blog, we will share our experience while working with Ribbon buttons.
If you need to click on ‘New’ button of any entity, use the command given below:
xrmApp.CommandBar.ClickCommand(“New”);
Also, if the button is present in More Commands (…), the ClickCommand function searches for OOB buttons in More Commands and executes the action.
In our case, we were facing difficulty in clicking a custom button that was a split button.
Scenario
Our button ‘Click2Undo’ is a custom split button, within which a History button is seen on clicking the down arrow.
However, we observed that it works with the OOB split button (Connect and To Another) after typing the following command.
xrmApp.CommandBar.ClickCommand(“Connect”, “To Another”);
The ‘Click2Undo’ button along with its dropdown button ‘History’ has 2 different actions to perform. On clicking the ‘Click2Undo’ button the fields changed are undone and on clicking on ‘History’ button a grid opens up.
Now the question arises, how do we click the ‘History’ button through Easyrepro?
For this, we tried to find out the name of the down arrow. We found out that the name ‘Click2Undo More Commands’ worked.
How did we find out that this will work? We observed that all the split buttons had the same pattern as <<button name More Commands>>.
So, after inspecting the Click2undo button we found out that the down arrow has the Arial-label name as ‘Click2Undo More Commands’.
Using this information, we tried to click the History button by using the following command:
After executing the command, the History button got clicked and the grid that was supposed to open after the click also opened.
Thus, we found out that this command works!
Conclusion
This guide on clicking the Ribbon buttons using Easyrepro will help those who are new to the features of Easyrepro or has just started working on the application.