microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
513 stars 285 forks source link

Is there any built in method to close the app? #1333

Open chandramohand opened 1 year ago

chandramohand commented 1 year ago

Is there any built in method to close the app?
Where I am running the tests in Scenario Outline for different user roles, at the end I am trying to use dispose or close and tried quit also. Finally I used to command line Chromedriver kill, where it clears from the task manager, but still chrome browser remains.

Could you please anyone help me. code snippet for close app: public static XrmApp CloseApp(BrowserOptions options = null) { //trace.Log($"Start ({CrmUrl})"); options = options ?? TestSettings.Options; SetOptions(options);

        _client = new WebClient(options);
        _xrmApp = new XrmApp(_client);            
            _xrmApp.Dispose();
            _xrmApp = null;
            //_client.Browser.Driver.Close();
            _client.Browser.Driver.Quit();
            _client.Browser.Dispose();

            _client = null;

        //trace.Log("Success");                              
        System.Diagnostics.ProcessStartInfo p;
        p = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/C " + "taskkill /f /im chromedriver.exe");
        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.StartInfo = p;
        proc.Start();
        proc.WaitForExit();
        proc.Close();

        return _xrmApp;
    }

thanks, Chandra.