public bool SearchResult_Verify_TextCol(string strValToCompare, string strVerifyColName) { try { WebTable w = new WebTable(testConfig); if (strVerifyColName == "Pickup Date" || strVerifyColName == "Delivery Date") { string fromdate = testData.Data("From_Date"); string todate = testData.Data("To_Date"); Assert.IsTrue(w.ColValues_Compare_ForDateRange(bySearchResHdr, bySearchRes, strVerifyColName, fromdate, todate)); } else { Assert.IsTrue(w.ColValues_Compare(bySearchResHdr, bySearchRes, strVerifyColName, strValToCompare)); } w = null; //action successs return(true); } catch { //action falied return(false); } }
public bool SearchResult_Verify_TextCol(string strValToCompare, string strVerifyColName) { try { Assert.IsTrue(_AccoutingPage.SearchTable.WaitUntilDisplayed()); WebTable w = new WebTable(testConfig); //Verify the col value matches the given string if (strVerifyColName == "Invoice Date" || strVerifyColName == "Load Date") { Assert.IsTrue(w.ColValues_Compare_ForDateRange(_AccoutingPage.SearchTableHeader.By, _AccoutingPage.SearchTable.By, strVerifyColName, _Data.FromDate, _Data.ToDate)); } else { Assert.IsTrue(w.ColValues_Compare(_AccoutingPage.SearchTableHeader.By, _AccoutingPage.SearchTable.By, strVerifyColName, strValToCompare)); } w = null; return(true); } catch { return(false); } }
public void UpdatePage(WebComponent source, WebSubmission values) { WebPage page = (WebPage)source; try { WebForm proc_form = (WebForm)page.Children.Where(o => o.ID.Equals("proc_form")).First(); WebTable proc_table = (WebTable)proc_form.Children.Where(o => o.ID.Equals("processes")).First(); proc_table.ClearRows(); foreach (ProcObject proc in this._pm.Processes) { WebComponent icon_img = null; if (null == proc.JpegB64) { proc.JpegB64 = ""; try { Bitmap pico = Icon.ExtractAssociatedIcon(proc.Filename).ToBitmap(); icon_img = new WebImage(pico); proc.JpegB64 = ((WebImage)icon_img).Src; } catch (Exception) { // XXX } } else { icon_img = new WebImage(proc.JpegB64); } if (null != icon_img) { ((WebImage)icon_img).WidthPx = 16; ((WebImage)icon_img).HeightPx = 16; } else { icon_img = new WebText(""); } proc_table.AddBodyRow( "proc-row-" + proc.ProcId, icon_img, new WebText(proc.ProcName), new WebText(proc.ProcId.ToString()), new WebText(proc.ProcUser), new WebText(proc.CPUPercent.ToString("n2")), new WebText(WebComponent.FormatDataSize(proc.ReadBytesSec)), new WebText(WebComponent.FormatDataSize(proc.WriteBytesSec)), new WebText(WebComponent.FormatDataSize(proc.WorkingSet)), new WebCheckbox("Kill", "proc_guid", proc.GUID.ToString()) ); } } catch (InvalidOperationException ex) { Trace.TraceError(ex.Message); } catch (NullReferenceException ex) { Trace.TraceError(ex.Message); } }
public Accouting(TestStartInfo info, DataManager datamanager) { testConfig = info; driver = info.Driver; _Page = new Page(info.Driver); _Data = new AccoutingData(datamanager); _Webtable = new WebTable(info.Driver); _AccoutingPage = new AccountingPage(info); _LoadDetailPage = new LoadDetailsPage(info); }
public void ClickByRightInStyleFolder() { SwitchToMain(); WebTable webTable = new WebTable(); webTable.ClickByRight(GridHeadersContextMenu, ContextMenuItems, 3); Thread.Sleep(3000); webTable.ClickByRight(GridHeadersContextMenu, ContextMenuItems, 1); }
public void TicketsToAnotherStation() { mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.ArrivalBystationName()) .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckElementsFromDepartureAndArrival("//span[contains(@class,'opFromSection')]", "Manchester Piccadilly ", "Birmingham Moor Street ")); }
public void TicketsByPostCode() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.ArrivalByPostcode()) .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckElementsFromDepartureAndArrival("//span[contains(@class,'opFromSection')]", "London Blackfriars ", "Manchester Piccadilly ")); }
public void TicketsByChoosingDepartureTime() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .OpenCloseAdditionalCriterias() .SetHours("21") .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckHours("//div[contains(@class,'opDepartTime')]", "21")); }
public void BuyingTicketWithoutSpecifyingInforamtionAboutArriveAndDepartue() { Browser.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); FromToStations fromToStations = new FromToStations(Browser).InputStations("Manchester", "London Blackfriars"); ConfirmSelectionCriteria confirmSelectionCriteria = new ConfirmSelectionCriteria(Browser).ClickSearchButton(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckElementsFromDepartureAndArrival("//span[contains(@class,'opFromSection')]", "Manchester Piccadilly", "London Blackfriars")); }
public void FirstCLassTickets() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .OpenCloseAdditionalCriterias() .SwitchStandardClass() .OpenCloseAdditionalCriterias() .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckTravelClass("//a[contains(@class,'op-listened')]", " First Class Anytime")); }
public void TwoWayTickets() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .OpenCloseAdditionalCriterias() .SwitchReturn() .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckElementsFromDepartureAndArrival("//span[contains(@class,'opFromSection')]", "London Blackfriars ", "Manchester Piccadilly ")); }
public void TakeJourneyFromRecent() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .Search() .BackToHome() .GetRecentTrain(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckElementsFromDepartureAndArrival("//span[contains(@class,'opFromSection')]", "London Blackfriars ", "Manchester Piccadilly ")); }
public string ValidateResult() { // DataTable ds = Import_ExcelWorkSheet(strSheetName); string TableName = testData.Data("TableName"); string ColName = testData.Data("ColName"); string Validation = testData.Data("Validation"); string Value1 = testData.Data("Value1"); string Value2 = testData.Data("Value2"); bool check = false; WebTable w = new WebTable(testConfig); check = DateRangeCheckInList(Value1, Value2, w.ColValues_DatesToList(bySearchResHdr, bySearchRes, ColName)); w = null; return("ResultsMatching"); }
public void FirstClassTickets() { wait = new WebDriverWait(Browser, TimeSpan.FromSeconds(5)); Browser.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); FromToStations fromToStations = new FromToStations(Browser).InputStations("Manchester", "London Blackfriars"); additionalCriterias = new AdditionalCriterias(Browser).OpenAdditionalCriteriasForm(); additionalCriterias = new AdditionalCriterias(Browser).AdditionalCriteriasChoise(); wait.Until(condition: ExpectedConditions.ElementToBeClickable(By.Id("opPasgrRlcrd"))); additionalCriterias = new AdditionalCriterias(Browser).CloseAdditionalCriteriasForm(); wait.Until(condition: ExpectedConditions.ElementToBeClickable(By.XPath("//span[contains(text(),'Go')]"))); ConfirmSelectionCriteria confirmSelectionCriteria = new ConfirmSelectionCriteria(Browser).ClickSearchButton(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckTravelClass("//a[contains(@class,'op-listened')]", "First class")); }
public void DragDrop() { SwitchToMain(); var countColumDrag = WebTable.DragDropHeaderTable(driver, table); SeleniumGetMethod.WaitForPageLoad(driver); int countDropCross = cross.Count; Assert.AreEqual(countColumDrag, countDropCross, "Count Drag Colum are not equal Count crosses "); int k = 0; for (var i = 0; i < countDropCross; i++) { //cross[i].Click(); var cr = driver.FindElement(By.ClassName("rgUngroup")); ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", cr); SeleniumGetMethod.WaitForPageLoad(driver); ++k; } Assert.AreEqual(countDropCross, k, "The number of clicks on crosses is not equal to the number of crosses found"); }
public bool validateTable(int row, int col, string expectedValue) { string cellVal = WebTable.FindRecordWithRowCol(row, col, PropertyType.ID, "table1"); return(cellVal == expectedValue); }
internal static WebControl GetWebControlFromIContol(IControl aControl, Browser aBrowser, Locator aLocator, ControlType aConrolType) { WebControl aWebControl = null; if (aConrolType == ControlType.Button) { WebButton aWebButton = new WebButton(aBrowser, aLocator); aWebButton.Control = aControl; aWebControl = aWebButton; } if (aConrolType == ControlType.EditBox) { WebEditBox aWebEditBox = new WebEditBox(aBrowser, aLocator); aWebEditBox.Control = aControl; aWebControl = aWebEditBox; } if (aConrolType == ControlType.Custom) { aWebControl = new WebControl(aBrowser, aLocator); aWebControl.Control = aControl; //aWebControl = aWebEditBox; } if (aConrolType == ControlType.Calender) { WebCalender aWebCalender = new WebCalender(aBrowser, aLocator); aWebCalender.Control = aControl; aWebControl = aWebCalender; } if (aConrolType == ControlType.ComboBox) { WebComboBox aWebComboBox = new WebComboBox(aBrowser, aLocator); aWebComboBox.Control = aControl; aWebControl = aWebComboBox; } if (aConrolType == ControlType.CheckBox) { WebCheckBox aWebCheckBox = new WebCheckBox(aBrowser, aLocator); aWebCheckBox.Control = aControl; aWebControl = aWebCheckBox; } if (aConrolType == ControlType.Dialog) { WebDialog aWebDialog = new WebDialog(aBrowser, aLocator); aWebDialog.Control = aControl; aWebControl = aWebDialog; } if (aConrolType == ControlType.Frame) { WebFrame aWebFrame = new WebFrame(aBrowser, aLocator); aWebFrame.Control = aControl; aWebControl = aWebFrame; } if (aConrolType == ControlType.Image) { WebImage aWebImage = new WebImage(aBrowser, aLocator); aWebImage.Control = aControl; aWebControl = aWebImage; } if (aConrolType == ControlType.Label) { WebLabel aWebLabel = new WebLabel(aBrowser, aLocator); aWebLabel.Control = aControl; aWebControl = aWebLabel; } if (aConrolType == ControlType.Link) { WebLink aWebLink = new WebLink(aBrowser, aLocator); aWebLink.Control = aControl; aWebControl = aWebLink; } if (aConrolType == ControlType.ListBox) { WebListBox aWebListBox = new WebListBox(aBrowser, aLocator); aWebListBox.Control = aControl; aWebControl = aWebListBox; } if (aConrolType == ControlType.Page) { WebPage aWebPage = new WebPage(aBrowser, aLocator); aWebPage.Control = aControl; aWebControl = aWebPage; } if (aConrolType == ControlType.RadioButton) { WebRadioButton aWebRadioButton = new WebRadioButton(aBrowser, aLocator); aWebRadioButton.Control = aControl; aWebControl = aWebRadioButton; } if (aConrolType == ControlType.SpanArea) { WebSpanArea aWebSpanArea = new WebSpanArea(aBrowser, aLocator); aWebSpanArea.Control = aControl; aWebControl = aWebSpanArea; } if (aConrolType == ControlType.WebTable) { WebTable aWebTable = new WebTable(aBrowser, aLocator); aWebTable.Control = aControl; aWebControl = aWebTable; } if (aConrolType == ControlType.WebRow) { WebRow aWebRow = new WebRow(aBrowser, aLocator); aWebRow.Control = aControl; aWebControl = aWebRow; } if (aConrolType == ControlType.WebCell) { WebCell aWebCell = new WebCell(aBrowser, aLocator); aWebCell.Control = aControl; aWebControl = aWebCell; } return(aWebControl); }
private bool Verify(string fieldName) { bool result = false; try { switch (fieldName) { case "LoadDate": //for factoring company's load date column if (_Data.FromDate == "!IGNORE!") { return(true); } else { Assert.IsTrue(VerifyColumn(_AccoutingPage.LoadDateColumn, "Load Date")); result = SearchResult_Verify_TextCol(_Data.FromDate, "Load Date"); } break; case "InvoiceStatus": if (_Data.InvoiceStatus == "!IGNORE!") { return(true); } else { Assert.IsTrue(VerifyColumn(_AccoutingPage.InvoiceStatusColumn, "Invoice Status")); result = SearchResult_Verify_TextCol(_Data.InvoiceStatus, "Invoice Status"); } break; case "CarrierName": if (_Data.CarrierName == "!IGNORE!") { return(true); } else { Assert.IsTrue(VerifyColumn(_AccoutingPage.CarrierNameColumn, "Carrier")); result = SearchResult_Verify_TextCol(_Data.CarrierName, "Carrier"); } break; case "Invoice Date": result = SearchResult_Verify_TextCol(_Data.FromDate, _Data.SearchBy); break; case "Load Date": //for customer's load date column result = SearchResult_Verify_TextCol(_Data.FromDate, _Data.SearchBy); break; case "Reference #": result = SearchResult_Verify_TextCol(_Data.SearchVal, "Ref #"); break; case "Check #": if (_Data.EntityName == "CUSTOMER") { result = SearchResult_Verify_TextCol(_Data.SearchVal, "Check"); } else { result = SearchResult_Verify_TextCol(_Data.SearchVal, "Check(s)"); } break; case "Pay Date(s)": WebTable w = new WebTable(testConfig); switch (_Data.InvoiceStatus) { case "In Process": Assert.IsTrue(w.ColValues_Contains(_AccoutingPage.SearchTableHeader.By, _AccoutingPage.SearchTable.By, "Pay Date(s)", "Expected", "--")); result = SearchResult_Verify_TextCol("--", "Check(s)"); break; case "Paid": Assert.IsFalse(w.ColValues_Contains(_AccoutingPage.SearchTableHeader.By, _AccoutingPage.SearchTable.By, "Pay Date(s)", "Expected", "--")); Assert.IsFalse(SearchResult_Verify_TextCol("--", "Check(s)")); result = true; break; } break; case "Invoice #": result = SearchResult_Verify_TextCol(_Data.SearchVal, "Invoice #(s)"); break; case "PRO #": result = SearchResult_Verify_TextCol(_Data.SearchVal, "PRO #"); break; } return(result); } catch { return(false); } }
public void CkeckSortGrid() { SwitchToMain(); PropertiesCollection._reportingTasks.Log(Status.Info, "UserAuto Sort Style Grid"); WebTable.ClickLinks(driver, table); }
private T GetControlFromLocator <T>(Locator aLocator) where T : WebControl { WebControl aWebCustomControl = null; if (typeof(T) == typeof(WebButton)) { aWebCustomControl = new WebButton(myBrowser, aLocator); } if (typeof(T) == typeof(WebEditBox)) { aWebCustomControl = new WebEditBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebCalender)) { aWebCustomControl = new WebCalender(myBrowser, aLocator); } if (typeof(T) == typeof(WebCheckBox)) { aWebCustomControl = new WebCheckBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebComboBox)) { aWebCustomControl = new WebComboBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebDialog)) { aWebCustomControl = new WebDialog(myBrowser, aLocator); } if (typeof(T) == typeof(WebFrame)) { aWebCustomControl = new WebFrame(myBrowser, aLocator); } if (typeof(T) == typeof(WebImage)) { aWebCustomControl = new WebImage(myBrowser, aLocator); } if (typeof(T) == typeof(WebLabel)) { aWebCustomControl = new WebLabel(myBrowser, aLocator); } if (typeof(T) == typeof(WebLink)) { aWebCustomControl = new WebLink(myBrowser, aLocator); } if (typeof(T) == typeof(WebListBox)) { aWebCustomControl = new WebListBox(myBrowser, aLocator); } if (typeof(T) == typeof(WebPage)) { aWebCustomControl = new WebPage(myBrowser, aLocator); } if (typeof(T) == typeof(WebRadioButton)) { aWebCustomControl = new WebRadioButton(myBrowser, aLocator); } if (typeof(T) == typeof(WebSpanArea)) { aWebCustomControl = new WebSpanArea(myBrowser, aLocator); } if (typeof(T) == typeof(WebTable)) { aWebCustomControl = new WebTable(myBrowser, aLocator); } if (typeof(T) == typeof(WebControl)) { aWebCustomControl = new WebControl(myBrowser, aLocator); } if (null == aWebCustomControl) { aWebCustomControl = new WebControl(myBrowser, aLocator); } if (aWebCustomControl.IsControlPresent()) { aWebCustomControl.GetControl(); } return((T)aWebCustomControl); }
public void Run() { try { // Setup event log. if (!EventLog.SourceExists("ProcMinder")) { EventLog.CreateEventSource("ProcMinder", "Application"); Console.WriteLine("Please restart the application to finish initializing logger."); //return; } // Create an EventLog instance and assign its source. this._logger = new EventLog(); this._logger.Source = "ProcMinder"; } catch (SecurityException ex) { Console.WriteLine(String.Format("Unable to setup logging: {0}", ex.Message)); } if (null != this._rc_url) { this._pm = new ProcMinder(this.ReportProcs, null, this._logger); } else { this._pm = new ProcMinder(); } string interval_str = RegistryGet("Interval", "No interval key found, using default: " + this._pm.Interval.ToString()); if (null != interval_str) { this._pm.Interval = int.Parse(interval_str); } // Setup the base page. this._cp = new WebControlPanel("Process Minder" /*, this.UpdatePage, this._pm*/); this._cp.AddRenderHandler("/index.html", this.UpdatePage); WebDiv nav = new WebDiv("nav"); WebLink nav_options = new WebLink("/options.html", new WebText("Options")); nav.Children.Add(nav_options); WebTable proc_table = new WebTable(); proc_table.SetHeadRow( null, new WebText(""), new WebText("Process Name"), new WebText("Process ID"), new WebText("User"), new WebText("CPU Time"), new WebText("Read Bytes/s"), new WebText("Write Bytes/s"), new WebText("Working Set"), new WebSubmit("execute", "Execute", this.OnKillButton) ); proc_table.ID = "processes"; WebForm proc_form = new WebForm("proc_form", "/"); proc_form.Children.Add(proc_table); WebPage page = (WebPage)this._cp.VFileSystem.Root.GetFile("index.html"); page.Children.Add(nav); page.Children.Add(proc_form); this._cp.AddOption("APIKey", this.OptRenderAPIKey, this.OnOptAPIKey); this._cp.AddOption("ReportServer", this.OptRenderReportServer, this.OnOptReportServer); this.LogInfo("Service started."); // Start polling and serving. this._pm.Run(); this._cp.Run(); this.Running = true; /* while( this.Running ) { * Thread.Sleep( 10000 ); * } */ }