public void CoautherWithConflict()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".docx']"));

            // Open document by office word
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Word"));
            var elementOpenInWord = Browser.webDriver.FindElement(By.LinkText("Open in Word"));

            Browser.Click(elementOpenInWord);
            // Close Microsoft office dialog and access using expected account
            Utility.CloseMicrosoftOfficeDialog();
            Utility.WaitForDocumentOpenning(filename, false, true);
            string username = ConfigurationManager.AppSettings["UserName"];
            string password = ConfigurationManager.AppSettings["Password"];

            Utility.OfficeSignIn(username, password);
            bool isWindowsSecurityPop = Utility.WaitForDocumentOpenning(filename, false, true);

            if (isWindowsSecurityPop)
            {
                Utility.OfficeSignIn(username, password);
            }
            // Wait for document is opened
            Utility.WaitForDocumentOpenning(filename);
            // Get the opened word process, and edit it
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Thread.Sleep(1000);
            Word.Document oDocument = (Word.Document)wordToOpen.ActiveDocument;
            oDocument.Content.InsertBefore("HelloWordConfilict");
            // Click the document in root site
            Browser.Click(document);
            Browser.Wait(By.Id("WebApplicationFrame"));
            Browser.webDriver.SwitchTo().Frame("WebApplicationFrame");
            Thread.Sleep(20000);
            // Find and click "Edit Document" tab
            Browser.Wait(By.Id("flyoutWordViewerEdit-Medium20"));
            var editWord = Browser.FindElement(By.XPath("//a[@id='flyoutWordViewerEdit-Medium20']"), false);

            editWord.Click();
            // Find and click "Edit in Browser" tab
            var editInbrowser = Browser.webDriver.FindElement(By.XPath("//a[@id ='btnFlyoutEditOnWeb-Menu32']"));

            editInbrowser.Click();
            // Wait for document is opened
            Thread.Sleep(2000);
            Browser.Wait(By.XPath("//span[@id='BreadcrumbSaveStatus'][text()='Saved']"));
            // Edit it in online
            SendKeys.SendWait("HelloOfficeOnlineConflict");
            // Wait for online edit saved
            Thread.Sleep(2000);
            Browser.Wait(By.XPath("//span[@id='BreadcrumbSaveStatus'][text()='Saved']"));
            //saved = Browser.FindElement(By.XPath("//span[@id='BreadcrumbSaveStatus']"), false);
            Thread.Sleep(60000);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            Thread.Sleep(50000);
            // Save it in office word and close and release word process
            Utility.WordEditSave(filename);
            Thread.Sleep(10000);
            Utility.CloseMicrosoftWordDialog(filename, "OK");
            Utility.WordConflictMerge(filename);
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }
        public void ExclusivelockCheck()
        {
            // Upload a document
            SharepointClient.UploadFile(Word);
            // Refresh web address
            Browser.Goto(Browser.DocumentAddress);
            // Find document on site
            IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".docx']"));

            // Open it by word
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Word"));
            var elementOpenInWord = Browser.webDriver.FindElement(By.LinkText("Open in Word"));

            Browser.Click(elementOpenInWord);
            // Close Microsoft office dialog and access using expected account
            Utility.CloseMicrosoftOfficeDialog();
            Utility.WaitForDocumentOpenning(filename);
            string username = ConfigurationManager.AppSettings["UserName"];
            string password = ConfigurationManager.AppSettings["Password"];

            Utility.OfficeSignIn(username, password);
            Utility.OfficeSignIn(username, password);
            Utility.WaitForDocumentOpenning(filename);
            // Check it out in info page
            Utility.CheckOutOnOpeningWord(filename);
            // Close word process
            Word.Application wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            Word.Document    oDocument  = (Word.Document)wordToOpen.ActiveDocument;
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            // Go back to base address
            Browser.Goto(Browser.DocumentAddress);
            // Reopen the document in word
            document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".docx']"));
            Browser.RClick(document);
            Browser.Wait(By.LinkText("Open in Word"));
            elementOpenInWord = Browser.webDriver.FindElement(By.LinkText("Open in Word"));
            Browser.Click(elementOpenInWord);
            // Close Microsoft office dialog and access using expected account
            Utility.CloseMicrosoftOfficeDialog();
            Utility.WaitForDocumentOpenning(filename);
            username = ConfigurationManager.AppSettings["OtherUserName"];
            password = ConfigurationManager.AppSettings["OtherPassword"];
            Utility.OfficeSignIn(username, password);
            Utility.CloseFileInUsePane(filename);
            Utility.OfficeSignIn(username, password);
            Utility.WaitForDocumentOpenning(filename, true);

            wordToOpen = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
            oDocument  = (Word.Document)wordToOpen.ActiveDocument;
            // CheckLockAvailability
            Thread.Sleep(60000);
            // Close and release word process
            Utility.CloseFileNowAvailable(filename);
            oDocument.Close();
            Utility.DeleteDefaultWordFormat();
            Marshal.ReleaseComObject(oDocument);
            Marshal.ReleaseComObject(wordToOpen);
            SharepointClient.UnLockItem(filename + ".docx");
            // Delete the new upload document
            SharepointClient.DeleteFile(filename + ".docx");

            bool result = FormatConvert.SaveSAZ(TestBase.testResultPath, testName, out file);

            Assert.IsTrue(result, "The saz file should be saved successfully.");
            bool parsingResult = MessageParser.ParseMessageUsingWOPIInspector(file);

            Assert.IsTrue(parsingResult, "Case failed, check the details information in error.txt file.");
        }