Search code examples
seleniumdynamics-crm-2013

Selenium Automation testing in crm 2015


We are going to implementation Selenium automation testing for functional testing in CRM 2015 (Client suggestion , because it is open source tool), I did a lot of exploration in Google and different search engine for Selenium for CRM 2015. Could you advise/guide me how to use selenium in crm 2015


Solution

  • I wonder why isn't it answered yet, basically you can install the nuget package and choose a webdriver for the browser you want to automate. Then write a console application like

        using OpenQA.Selenium;
        using OpenQA.Selenium.IE;
    
        string crmUrl = "http://mycrm.url";
        //create a ieAutomation
        IWebDriver ieAutomation = new InternetExplorerDriver();//BrowserDriver
        
        // open url
        ieAutomation.Navigate().GoToUrl(crmUrl);
        
        // find element by id and set text
        ieAutomation.FindElement(By.Id("name")).SendKeys("set the text");
                        
        // find element by id and make a click
        ieAutomation.FindElement(By.Id("id")).Click();
        
        // close the driver & exit
        ieAutomation.Close();
        ieAutomation.Quit();
    

    This is one quick startup tutorial to start with, you can found more in the documentation. Although being a SPA it's too expensive to set it up and not worth the effort but LEAPTEST claims it be easy with a price.

    Note: make sure IEDriverServer.exe is available in the Bin\Debug folder

    Update 2020:

    Looking back to this answer i found a Sikuli to be more useful, as it identifies the objects by using image recognition and control GUI (Graphical User Interface) components. Sikuli is good option when there is no easy access to a GUI's internal or source code.

    For that, you can add Nuget reference

      <package id="SikuliIntegrator" version="1.1.0" targetFramework="net452" />
    

    You can save the screenshots to a folder say in c:\\crm folder and use the code below:

    static void Main(string[] args)
    {
    
        SikuliModule.SikuliAction.Click("C:\\crm\\Sales.png");
        SikuliModule.SikuliAction.Click("C:\\crm\\Accounts.png");
        SikuliModule.SikuliAction.Click("C:\\crm\\New.png");
        SikuliModule.SikuliAction.DoubleClick("C:\\crm\\ParentAccountQ.png");
        SikuliModule.SikuliAction.Click("C:\\crm\\LookupLense.png");
        //SikuliModule.SikuliAction.Click()
    }