/// <summary><para>Tests Intact Recognition</para> /// <para>definitionName: definition of what you want to recognize, documentName: document name,input: string to search to see if the page recognizes it </para> /// </summary> public void Recognition(string definitionName, string documentName, string input) { CreateDocumentForRecognize(); AddRecognition(); OpenOrganizer(); m.Click(By.Name(definitionName)); window = m.Locate(By.Name(documentName)); action.DoubleClick(window).Build().Perform(); Thread.Sleep(2000); Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y); m.Click(By.Id("lblType")); Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y); action.MoveByOffset(470, -40).Click().Build().Perform(); Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y); window = m.Locate(By.Name("Find")); m.SendKeys(By.Name(""), input, m.Locate(By.Id("txtFind"), window)); m.Click(By.Id("btnFind")); if (m.IsElementPresent(By.Name("Search Text Not Found"), window)) { Print(method, "Search Text not found for Recognize"); //throw new AssertFailedException("Search Text not found for Recognize"); } m.Click(By.Id("btnCancel")); m.Click(By.Id("btnClose")); }
public void AddToIPack() { OpenOrganizer(); window = m.Locate(By.Name("DEFAULT DEF")); action.MoveToElement(window).ContextClick().Build().Perform(); window = m.Locate(By.Name("DropDown")); m.Click(By.Name("Add to iPack...")); m.Click(By.Name("Yes")); m.Click(By.Id("btnNewIpack")); Thread.Sleep(1000); window = m.Locate(By.Id("frmNewiPack")); m.SendKeys(By.Name(""), "test" + new Random().Next().ToString(), window); m.Click(By.Id("rbnOK")); m.Click(By.Id("btnOK")); window = m.Locate(By.Name("&Intact"), m.Locate(By.Name("radMenu1"))); m.Click(By.Name("iPack"), window); //m.Click(By.Id("rbnBatch")); Thread.Sleep(1000); window = m.Locate(By.Id("frmIntactMain")); if (m.IsElementPresent(By.Name("No documents were selected"), window)) { m.Click(By.Name("OK")); } Thread.Sleep(1000); m.Click(By.Id("radButton1")); Thread.Sleep(5000); }
/// <summary> Login to Intact: Has to be ran before any other testcase</summary> public void Login() { bool needToSetDB = ConfigurationManager.AppSettings.Get("setDataBase") == "true"; Thread.Sleep(10000); m.SendKeys(By.Name(""), "admin"); if (needToSetDB) { SetDatabaseInformation(); } m.Click(By.Name("&Logon")); Thread.Sleep(2000); }
//find the document to add in file explorer //configure docpath in app.config, takes arg of pdf or tif private void FileExplorer(bool isPDF, string docPath, int?fileNumber) { if (docPath.Length < 1) { docPath = ConfigurationManager.AppSettings.Get("AddDocumentStorage"); } m.SendKeys(By.Id("1001"), docPath); Print("Go to \"" + docPath + "\"", method); m.Click(By.Name("Go to \"" + docPath + "\"")); var rand = new Random(); if (isPDF) { Winium.Elements.Desktop.ComboBox filesOfType = new Winium.Elements.Desktop.ComboBox(m.Locate(By.Name("Files of type:"))); filesOfType.SendKeys("p"); filesOfType.SendKeys(OpenQA.Selenium.Keys.Enter); Thread.Sleep(500); if (fileNumber == 0) { action.MoveToElement(m.Locate(By.Id(rand.Next(Directory.GetFiles(docPath, "*.pdf").Length).ToString()))).DoubleClick().Build().Perform(); } else { action.MoveToElement(m.Locate(By.Id(fileNumber.ToString()))).DoubleClick().Build().Perform(); } //m.Click(By.Name("Open")); } else { if (fileNumber == 0) { action.MoveToElement(m.Locate(By.Id(rand.Next(Directory.GetFiles(docPath, "*.tif").Length).ToString()))).DoubleClick().Build().Perform(); } else { action.MoveToElement(m.Locate(By.Id(fileNumber.ToString()))).DoubleClick().Build().Perform(); } //m.Click(By.Name("Open")); } Thread.Sleep(2000); }