Can we use Selenium webdriver for automating MS CRM 2015 based application?If not, is there any specific reason for that.
-
What exactly do you want to automate? – Denis Koreyba Oct 13 '15 at 14:17
-
I want to automate my MS CRM 2015 based web application through selenium. For insatance i have to automate contact & lead module. – Vikash Yadav Oct 15 '15 at 09:47
-
Which actions do you want to automate? – Denis Koreyba Oct 15 '15 at 10:12
3 Answers
Selenium can automate any part of a web page if it is based on HTML. So if you want to check it, open the CRM web application, open the browser console and confirm if all the elements required for your automation test are based on HTML.
The non-HTML components of a web page cannot be accessed by Selenium. You might want to use Image Based testing tools like Sikuli.

- 3,719
- 2
- 24
- 41
-
Hi Thanks for your response, MS Dynamics CRM's entity form elements are exposed through the Xrm.Page object model. I am not sure whether it is non-HTML component. – Vikash Yadav Oct 15 '15 at 09:29
-
-
That certainly is HTML... Try automating one flow as proof of concept and then proceed. Is there any browser restriction. like application will only open in IE? – StrikerVillain Oct 15 '15 at 09:46
-
Thanks. I am currently working on POC part, there is no such restriction for browser, But yes best fit for IE only. – Vikash Yadav Oct 15 '15 at 09:54
-
IE can create instability issues with Selenium. This is from my experience. I have worked on an older version of CRM application and we were able to automate it. But it was less stable compared to normal applications.. Anyhow, happy coding!! – StrikerVillain Oct 15 '15 at 09:59
-
Do you think it will cause any major issues as MS CRM doesn't offer control over HTML dom, So it is possible that regular update will change locators id's or page references. Is there some way to deal with it ? – Vikash Yadav Oct 20 '15 at 10:41
-
I believe that page load wait time is going to be your biggest challenge. Eg: When you click a Save button, the application may freeze for some time. Making your code modular and using page factory (so that xpaths and other identifiers can be easily changed in one location) could help a lot in case of code changes – StrikerVillain Oct 21 '15 at 10:49
Since there is a duplicated question (Does Selenium suports CRM applications) asked recently, I'll provide my answer here.
I have successfully implemented selenium webdriver automation with Dynamics CRM. The main differences between CRM and other websites are:
- Use of iframes. Be sure to switch to the correct frame that contains the element you wish to work on, e.g.
driver.switchTo().frame(the_frame_id)
, or better yet, implicitly wait for the frame by usingExpectedConditions.frameToBeAvailableAndSwitchToIt(by)
- As mentioned by others, wait for loading times. But instead of hard sleeps or explicit waits, I found that CRM actually displays nice spinning "Loading..." messages while it's loading. So to wait for the message to go away before performing further actions, I've used
ExpectedConditions.invisibilityOfElementLocated(locator_of_loading_dialog)
; or for some trickier ones where the visibility is driven by a different attribute value other thandisplay
, tryExpectedConditions.attributeContains(locator, attribute, value)
- e.gExpectedConditions.attributeContains(By.id("some_id"), "style", "visibility: hidden")
.
Other than that, it's just another web site.

- 902
- 12
- 24
Although it will be lot of work CRM
being a SPA
but you can get your way out. Here is something i answered for a similar question, in order to avoid copying it over please see it here Selenium Automation testing in crm 2015

- 3,644
- 1
- 27
- 40