public void TestReadExcel() { string xlPath = @"C:\Users\anushri.mundada\source\repos\SeleniumProject\TestData\FlightSearch.xlsx"; Console.WriteLine(ExcelReaderHelper.GetCellData(xlPath, "Search", 2, 0)); Console.WriteLine(ExcelReaderHelper.GetCellData(xlPath, "Search", 2, 1)); }
/// <summary> /// Gets the cell value. /// </summary> /// <param name="worksheet">The worksheet.</param> /// <param name="column">The column.</param> /// <param name="row">The row.</param> /// <returns>object representing cell</returns> internal object GetCellValue(Worksheet worksheet, string column, uint row) { Cell cell = ExcelReaderHelper.GetCell(worksheet, column, row); if (cell == null) { return(null); } return(ExcelReaderHelper.GetCellValue(_spreadsheetDocument, cell)); }
public void TestMultipleSheet() { var path = @"C:\Users\rahul.rathore\Desktop\Lakshmi\CFMOasisRegistrationTestData.xlsx"; var sheets = ExcelReaderHelper.GetTotalSheets(path); for (var i = 0; i < sheets; i++) { var hpage = new HomePageClass(ObjectRepository.Driver); DataEngine.ExecuteScript(hpage, path, "CFMOasisA"); } }
public void TestMultipleSheet() { var path = @"CFMOasisRegistrationTestData.xlsx"; var sheets = ExcelReaderHelper.GetAllSheetName(path); foreach (var sheetName in sheets) { var hpage = new HomePageClass(ObjectRepository.Driver); DataEngine.ExecuteScript(hpage, path, sheetName); } }
public void foo() { string XlsPath = @"C:\Users\Bassam\Documents\Training\DataDriven\ExcelTestData\TcoData.xlsx"; //int pax = 45; //Console.WriteLine(" pay :{0}", CalculateCalimityFund(pax)); var res = ExcelReaderHelper.GetCelldata(XlsPath, "DocketsNumber", 0, 0).ToString(); Console.WriteLine("res is {0}", res); }
public static void LoginFromExcelFile() { string FilePath = @"E:\Users\Bassam\Documents\Training\DataDriven\ExcelTestData\TcoData.xlsx"; NavigateToUrl(ObjectRepository.Config.GetWebSite()); DropDownListHelper.SelectElementByText(By.Id("cmbCompanies"), "Vered Hasharon"); PomLogin TcoLogin = new PomLogin(ObjectRepository.Driver); TcoLogin.Login(ExcelReaderHelper.GetCelldata(FilePath, "Login", 1, 0).ToString(), ExcelReaderHelper.GetCelldata(FilePath, "Login", 1, 1).ToString()); Thread.Sleep(2000); }
public void WhenUserEnterStartDateEndDateTimeAndDays() { var Startdate = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 4); var Enddate = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 5); LinkHelper.ClickLink(By.XPath("//input[contains(@id,'mat-input-82')]")); TextBoxHelper.TypeInTexBox(By.XPath("//input[contains(@id,'mat-input-82')]"), Startdate.ToString()); LinkHelper.ClickLink(By.XPath("//input[contains(@id,'mat-input-83')]")); TextBoxHelper.TypeInTexBox(By.XPath("//input[contains(@id,'mat-input-83')]"), Enddate.ToString()); LinkHelper.ClickLink(By.Id("mat-select-9")); LinkHelper.ClickLink(By.XPath("")); }
public void ExecuteScripts(string xlPath, string sheetName) { int totalRows = ExcelReaderHelper.GetTotalExcelColumns(xlPath, sheetName); for (int i = 1; i < totalRows; i++) { var keyword = ExcelReaderHelper.GetCellData(xlPath, sheetName, i, _keywordCol).ToString(); var locatorType = ExcelReaderHelper.GetCellData(xlPath, sheetName, i, _locatorTypeCol).ToString(); var locatorVal = ExcelReaderHelper.GetCellData(xlPath, sheetName, i, _locatorValueCol).ToString(); var para = ExcelReaderHelper.GetCellData(xlPath, sheetName, i, _parameterCol).ToString(); PerformActions(keyword, locatorType, locatorVal, para); } }
public void TestBug() { string xlpath = @"C:\Users\anushri.mundada\source\repos\SeleniumProject\TestData\FlightSearch.xlsx"; NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite()); HomePageusingFW hpage = new HomePageusingFW(ObjectRepository.Driver); LoginusingFW lpage = hpage.NavigatetoLoginpopup(); var ePage = lpage.Login(ObjectRepository.Config.GetUserName(), ObjectRepository.Config.GetPassword()); // hpage.QuickSearch(TestContext.DataRow["Origin"].ToString(), TestContext.DataRow["Destination"].ToString()); hpage.QuickSearch(ExcelReaderHelper.GetCellData(xlpath, "Search", 1, 0).ToString(), ExcelReaderHelper.GetCellData(xlpath, "Search", 1, 1).ToString()); hpage.Logout(); }
public void DadoQuePossuoUmUsuario(string tipo) { string caminhoAssembly = System.IO.Directory.GetCurrentDirectory(); caminhoAssembly = new Uri(caminhoAssembly).LocalPath; string novoCaminho = Path.GetFullPath(Path.Combine(caminhoAssembly, @"../../")); string caminhoPlanilha = novoCaminho + "MassaDeDados\\" + "Login.xlsx"; string query = "SELECT * FROM [Plan1$] where [Tipo] = '" + tipo + "'"; DataSet ds = ExcelReaderHelper.QueryFromSheet(caminhoPlanilha, query); loginFields = new LoginFieldsHelper(); loginFields.usuario = ds.Tables[0].Rows[0]["Usuario"].ToString(); loginFields.senha = ds.Tables[0].Rows[0]["Senha"].ToString(); }
/// <summary> /// Gets the worksheet. /// </summary> /// <param name="name">The name.</param> /// <returns>the selected Worksheet</returns> internal Worksheet GetWorksheet(string name) { if (_spreadsheetDocument == null) { return(null); } WorksheetPart wspart = ExcelReaderHelper.GetWorksheetPartByName(_spreadsheetDocument, name); if (wspart == null) { return(null); } return(wspart.Worksheet); }
/// <summary> /// Gets all worksheet. /// </summary> /// <returns>the selected Worksheet</returns> internal IEnumerable <Worksheet> GetAllWorksheet() { if (_spreadsheetDocument == null) { return(null); } IEnumerable <WorksheetPart> worksSheetPartsList = ExcelReaderHelper.GetWorksheetParts(_spreadsheetDocument); if (worksSheetPartsList != null) { return(worksSheetPartsList.Where(w => w?.Worksheet != null).Select(w => w.Worksheet)); } return(new List <Worksheet>()); }
public void TestPage() { string xlPath = @"C:\Users\prade\source\Workspaces\Apply\UnitKubra\ExcelReader\kubra.xlsx"; NavigationHelper.NavigateToUrl((string)ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 0)); Enbridge enbridge = new Enbridge(ObjectRepository.driver); enbridge._ApplicationsLinkButton(); enbridge._AdminConsoleLink(); enbridge._UserLinkInAdminConsole(); enbridge._SearchButtonInUserLink(); enbridge._DatatablePresent(); enbridge._CloseAdminConsoleWindow(); enbridge.NavigateToBackToEnbridgeApplicationsPage(); }
public static void SelectIncomingToursAndOpenById() { LoginFromConfigFile(); LoginPagePOM LogMe = new LoginPagePOM(ObjectRepository.Driver); QuotationsList quoteList = LogMe.WelcomToTco.ClickIncoming(); string FilePath = @"E:\Users\Bassam\Documents\Training\DataDriven\ExcelTestData\TcoData.xlsx"; //Assert that you are in the right page Assert.AreEqual("QUOTATION / GROUPS LIST", quoteList.PageTitle, "the titles are not equals"); var HoverAnElement = ObjectRepository.Driver.FindElement(By.XPath("//td[@id='ctl00_ContentPlaceHolder1_mnuTopn0']//a[contains(text(),'Sheets')]")); var ElementClick = ObjectRepository.Driver.FindElement(By.XPath("//a[contains(text(),'Open Calc.sheet/Group by number')]")); MouseActionsHelper.HoverAndClick(ObjectRepository.Driver, HoverAnElement, ElementClick); //switch to the new frame by invoking OpenExistingQuote Method GenericHelper.OpenExistingQuote(ExcelReaderHelper.GetCelldata(FilePath, "Quotations", 1, 0).ToString()); }
public void CreateBugDDF() { string xlPath = @"D:\Git\SeleniumWebdriver\DataFiles\DataForBug.xlsx"; Console.WriteLine(ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 0, 0)); NavigationHelper.NavigationToURL(ObjectRepository.Config.GetWebsite()); HomePage hPage = new HomePage(ObjectRepository.Driver); LoginPage loginPage = hPage.NavigateToLogin(); BugDetail bugDetail = loginPage.LoginToPage(ObjectRepository.Config.GetUsername(), ObjectRepository.Config.GetPassword()); bugDetail.SelectDropdownList(ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 0).ToString(), ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 1).ToString(), ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 2).ToString()); bugDetail.FillInTextbox(ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 3).ToString(), ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 4).ToString()); bugDetail.SubmitBug(); hPage = bugDetail.Logout(); }
public void TestBugDdf() { string xlPath = @"C:\Development\Repos\FrameWorkSetUp\ExcelData.xlsx"; NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite()); HomePage hpPage = new HomePage(ObjectRepository.Driver); LoginPage loginPage = hpPage.NavigateToLogin(); var ePage = loginPage.Login(ObjectRepository.Config.GetUsername(), ObjectRepository.Config.GetPassword()); //var bugPage = ePage.NavigateToDetail(); //ePage.SelectFromCombo(TestContext.DataRow["Severity"].ToString(), TestContext.DataRow["HardWare"].ToString(), TestContext.DataRow["OS"].ToString()); //ePage.TypeIn(TestContext.DataRow["Summary"].ToString(), TestContext.DataRow["Desc"].ToString()); //ePage.ClickOnNew(); ePage.SelectFromCombo(ExcelReaderHelper.GetCellData(xlPath, "TestExcelData", 1, 0).ToString(), ExcelReaderHelper.GetCellData(xlPath, "TestExcelData", 1, 1).ToString(), ExcelReaderHelper.GetCellData(xlPath, "TestExcelData", 1, 2).ToString()); ePage.TypeIn(ExcelReaderHelper.GetCellData(xlPath, "TestExcelData", 1, 3).ToString(), ExcelReaderHelper.GetCellData(xlPath, "TestExcelData", 1, 4).ToString()); ePage.Logout(); Thread.Sleep(5000); }
/// <summary> /// Gets the row values. /// </summary> /// <param name="worksheet">The worksheet.</param> /// <param name="rowIndex">Index of the row.</param> /// <returns>A Dictionary containing row values</returns> internal Dictionary <string, object> GetRowValues(Worksheet worksheet, int rowIndex) { Dictionary <string, Cell> rowCells = ExcelReaderHelper.GetRowCells(worksheet, (uint)rowIndex); if (rowCells == null) { return(null); } Dictionary <string, object> rowValues = new Dictionary <string, object>(); foreach (KeyValuePair <string, Cell> element in rowCells) { rowValues.Add(element.Key, ExcelReaderHelper.GetCellValue(_spreadsheetDocument, element.Value)); } return(rowValues); }
public void WhenSelectClaimTypeDivisionDepartmentClaimStatusFiltesrAndClickOnTheRunNowButton() { var ApplicationRCDVDate = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 2); var LeaveStartDate = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 3); LinkHelper.ClickLink(By.Id("mat-input-3")); TextBoxHelper.TypeInTexBox(By.Id("mat-input-3"), ApplicationRCDVDate.ToString()); LinkHelper.ClickLink(By.Id("mat-input-4")); TextBoxHelper.TypeInTexBox(By.Id("mat-input-4"), LeaveStartDate.ToString()); LinkHelper.ClickLink(By.XPath("//mat-select[contains(@id,'mat-select-2') or class='mat-select ng-tns-c14-51 ng-pristine ng-valid mat-select-empty ng-star-inserted ng-touched']")); LinkHelper.ClickLink(By.XPath("//span[text()='OP4315']")); cRpage.ClickOnRunNowButton(); Thread.Sleep(5000); }
/// <summary> /// Creates a new instance of <see cref="BenchmarkTestInput"/>. /// </summary> /// <param name="excelFileName">The name of the excel file.</param> /// <param name="testName">The test name.</param> /// <returns>A <see cref="BenchmarkTestInput"/>.</returns> public static BenchmarkTestInput Read(string excelFileName, string testName) { if (!File.Exists(excelFileName)) { return(null); } var benchmarkTestInput = new BenchmarkTestInput { FileName = excelFileName, TestName = testName }; using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(excelFileName, false)) { WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart; var workSheetParts = ExcelReaderHelper.ReadWorkSheetParts(workbookPart); ReadGeneralAssessmentSectionInformation(workSheetParts["Normen en duidingsklassen"], workbookPart, benchmarkTestInput); var tabsToIgnore = new[] { "Informatiepagina", "Normen en duidingsklassen", "Veiligheidsoordeel", "Gecombineerd vakoordeel" }; var failureMechanismsTabs = workSheetParts.Select(wsp => wsp.Key).Except(tabsToIgnore).ToArray(); foreach (var failureMechanismsTab in failureMechanismsTabs) { ReadFailureMechanism(failureMechanismsTab, workSheetParts[failureMechanismsTab], workbookPart, benchmarkTestInput); } ReadSafetyAssessmentFinalResult(workSheetParts["Veiligheidsoordeel"], workbookPart, benchmarkTestInput); ReadCombinedAssessmentSectionResults(workSheetParts["Gecombineerd vakoordeel"], workbookPart, benchmarkTestInput); return(benchmarkTestInput); } }
public void VerifyDataInScheduleTable() { string title = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 0).ToString(); filter_Search.Click(); filter_Search.SendKeys(ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 0).ToString()); // Assert.AreEqual(TitleXpath.Text, ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 0)); List <IWebElement> rows = new List <IWebElement>(driver.FindElements(By.TagName("tr"))); Console.WriteLine(rows.Count); for (int i = 1; i < rows.Count(); i++) { String name = driver.FindElement(By.XPath("//table/tbody/tr[" + i + "]/td[1]")).Text; if (name.Contains(title)) { //JavaScriptExecutor.ScrollToAndClick(By.XPath("(//mat-icon[text()='delete'])[1]")); //Thread.Sleep(2000); //JavaScriptExecutor.ScrollToAndClick(By.XPath("//button[@color='primary' or @class='mat-raised-button mat-button-base mat-primary']//span[text()='Yes']")); Assert.AreEqual(name, title); } } }
public void HelpForm() { try { homePage.NavigateToSubMenu(homePage.WeAreWabashMenu, homePage.SupportSubMenu); supportPage = new SupportPage(); supportPage.FillOutForm(ExcelReaderHelper.GetCellData(excelPath, 1, 0), ExcelReaderHelper.GetCellData(excelPath, 1, 1), ExcelReaderHelper.GetCellData(excelPath, 1, 2), ExcelReaderHelper.GetCellData(excelPath, 1, 3), ExcelReaderHelper.GetCellData(excelPath, 1, 4), ExcelReaderHelper.GetCellData(excelPath, 1, 5), ExcelReaderHelper.GetCellData(excelPath, 1, 6)); supportPage.SubmitForm(); if (supportPage.GetSuccessMessage() != null) { actualMessage = supportPage.GetSuccessMessage(); } else { throw new Exception("Success message isn't present on the page"); } Assert.AreEqual(supportPage.ExpectedMessage, actualMessage, string.Format("Actual message: <{0}> is not equal to expected message: <{1}>", actualMessage, supportPage.ExpectedMessage)); Logger.Info("ASSERT - Form completed successfuly"); } catch (Exception exception) { GenericHelper.TakeScreenShot(); Logger.Error(exception.Message); Logger.Error(exception.StackTrace); throw; } }
public void EnterDataIntitleTextBox() { var title = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 0); TitleTextBox.SendKeys(title.ToString()); }
public void EnterdataRecipientTextBox() { var RecipientId = ExcelReaderHelper.GetCellData(xlPath, "Sheet1", 1, 1); RecipientTextBox.SendKeys(RecipientId.ToString()); }
/// <summary> /// Gets the cell value. /// </summary> /// <param name="cell">The cell.</param> /// <returns>The cell value as object.</returns> internal object GetCellValue(Cell cell) { return(ExcelReaderHelper.GetCellValue(_spreadsheetDocument, cell)); }