// public string CreateCustomerDetails(string colconame, int i, string lineofbusiness, string band) public string CreateCustomerDetails(string colconame, int i) { string customerERP = ""; string pth = AppDomain.CurrentDomain.BaseDirectory; Actions action = new Actions(DriverContext.GetDriver <IWebDriver>()); IReadOnlyCollection <string> all_windowHandles = DriverContext.GetDriver <IWebDriver>().WindowHandles; foreach (string handle in all_windowHandles) { DriverContext.GetDriver <IWebDriver>().SwitchTo().Window(handle); if (DriverContext.GetDriver <IWebDriver>().Title.Contains(colconame)) { string fileName = ConfigReader.TestDataFilepath; ExcelHelper eat = new ExcelHelper(fileName); string strWorksheetName = eat.getExcelSheetName(fileName, 1); BrowserHelper.BrowserMaximize(); action.MoveToElement(Start).Build().Perform(); action.MoveToElement(Customers).Build().Perform(); action.MoveToElement(CreatetopLevelCustomer).Click().Build().Perform(); ComboBoxHelper.SelectInDropDownByText(LineOfBusiness, eat.GetCellData(strWorksheetName, "LineOfBusiness", i)); ComboBoxHelper.SelectInDropDownByText(LineOfBusiness, lineofbusiness); string randomnumber = RandomNumberandStringGenerator.randomnumberwithoneargument(6); string fullname = "Automation" + randomnumber; TextBoxHelper.ClearandTypeinTextBox(FullName, fullname); TextBoxHelper.ClearandTypeinTextBox(ShortName, fullname); TextBoxHelper.ClearandTypeinTextBox(TradingName, fullname); ComboBoxHelper.SelectInDropDownByText(LegalEntity, eat.GetCellData(strWorksheetName, "LegalEntity", i)); TextBoxHelper.ClearandTypeinTextBox(IncorporationDate, eat.GetCellData(strWorksheetName, "IncorporationDate", i)); IncorporationDate.SendKeys(Keys.Tab); TextBoxHelper.ClearandTypeinTextBox(VATRegistrationNumber, randomnumber); ComboBoxHelper.SelectInDropDownByText(Band, eat.GetCellData(strWorksheetName, "Band", i)); ComboBoxHelper.SelectInDropDownByText(MarketingSegmentation, eat.GetCellData(strWorksheetName, "MarketingSegmentation", i)); TextBoxHelper.ClearandTypeinTextBox(CreditLimit, eat.GetCellData(strWorksheetName, "CreditLimit", i)); TextBoxHelper.ClearandTypeinTextBox(RequestedLimit, eat.GetCellData(strWorksheetName, "RequestedLimit", i)); Save.Click(); customerERP = DriverContext.GetDriver <IWebDriver>().FindElement(By.XPath("")).GetAttribute("value"); LogHelper.WriteLog(ConfigReader.logFilePath, "Customer ERP is :-" + customerERP); string customerERPValue = eat.SetCellData(strWorksheetName, "CustomerERP", i, customerERP); } } return(customerERP); }
public string CreateCustomerDetails(string colconame, int i, string lineofbusiness, string band) { string customerERP = ""; string pth = AppDomain.CurrentDomain.BaseDirectory; Actions action = new Actions(DriverContext.Driver); IReadOnlyCollection <string> all_windowHandles = DriverContext.Driver.WindowHandles; foreach (string handle in all_windowHandles) { if (DriverContext.Driver.Title.Contains(colconame)) { string fileName = @""; ExcelHelper eat = new ExcelHelper(fileName); BrowserHelper.BrowserMaximize(); action.MoveToElement(Start).Build().Perform(); action.MoveToElement(Customers).Build().Perform(); action.MoveToElement(CreatetopLevelCustomer).Click().Build().Perform(); ComboBoxHelper.SelectInDropDownByText(LineOfBusiness, lineofbusiness); string randomnumber = RandomNumberandStringGenerator.randomnumberwithoneargument(6); string fullname = "Automation" + randomnumber; TextBoxHelper.ClearandTypeinTextBox(FullName, fullname); TextBoxHelper.ClearandTypeinTextBox(ShortName, fullname); TextBoxHelper.ClearandTypeinTextBox(TradingName, fullname); } } return(customerERP); }