public void CustomerAddress(int i)
        {
            string      fileName         = ConfigReader.TestDataFilepath;
            ExcelHelper eat              = new ExcelHelper(fileName);
            string      strWorksheetName = eat.getExcelSheetName(fileName, 2);
            Actions     action           = new Actions(DriverContext.GetDriver <IWebDriver>());

            action.MoveToElement(CustomerDetails).Build().Perform();
            action.MoveToElement(Address).Build().Perform();
            Address.Click();
            NewAddress.Click();
            TextBoxHelper.TypeInTextBox(AddressTextBox, eat.GetCellData("Address", "AddressTextBox", i));
            TextBoxHelper.TypeInTextBox(Address_City, eat.GetCellData("Address", "Address_city", i));

            ComboBoxHelper.SelectElementByText(Address_Region, eat.GetCellData("Address", "Address_Region", i));

            TextBoxHelper.TypeInTextBox(Address_PostalCode, eat.GetCellData("Address", "Address_PostalCode", i));

            Address_AddressType_Main.Click();

            Address_AddressType_Registered.Click();

            Address_AddressType_Correspondence.Click();

            Save.Click();
        }
Esempio n. 2
0
        public void CreateApplicationUrl()
        {
            _webDriver = DriverContext
                         .GetDriver(TestContext.Parameters.Get("browser", AtConfiguration.GetConfiguration("Browser")));

            _webDriver.Navigate().GoToUrl(AtConfiguration.GetConfiguration("TestUrl"));
        }
        public void CustomerContacts(int i)
        {
            string      fileName         = ConfigReader.TestDataFilepath;
            ExcelHelper eat              = new ExcelHelper(fileName);
            string      strWorksheetName = eat.getExcelSheetName(fileName, 3);

            Actions action = new Actions(DriverContext.GetDriver <IWebDriver>());

            action.MoveToElement(Customer_HeaderTab).Build().Perform();
            action.MoveToElement(Contacts).Build().Perform();

            Contacts.Click();

            Contacts_NewContact.Click();
            TextBoxHelper.TypeInTextBox(Contacts_ForeName, eat.GetCellData("Contacts", "Contacts_ForeName", i));

            TextBoxHelper.TypeInTextBox(Contacts_SurName, eat.GetCellData("Contacts", "Contacts_SurName", i));

            TextBoxHelper.TypeInTextBox(Contacts_Telephone, eat.GetCellData("Contacts", "Contacts_Telephone", i));

            TextBoxHelper.TypeInTextBox(Contacts_Email, eat.GetCellData("Contacts", "Contacts_Email", i));

            Contacts_PinDelivery.Click();

            Contacts_CardDelivery.Click();

            Save.Click();
        }
Esempio n. 4
0
        public void Job19forSalesItem(string customerid, string salesitemid)
        {
            string BilledSalesItemid = "";
            string JOBSTATUSID       = "";

            try
            {
                //BATCH
                DBHelper.executesqlandwritetocsvmultipletables(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "BATCH",
                                                               "select VoucherNumber,CustomerID,SalesItemID from SalesIemUnbilled where customerid='" + customerid + "' and salesitemid='" + salesitemid + "'");
                LogHelper.WriteLog(ConfigReader.logFilePath, "SalesItem to Bill" + salesitemid);
                //BATCH
                DBHelper.executesqlandwritetocsvmultipletables(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "BATCH", "select Top 1 * from job where jobtypeid=19 order by 1 desc");
                string ID = ExcelHelper.Readcsvcolumnnamerownumberwise(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "ID", 1);
                DBHelper.executesqlandwritetocsvmultipletables(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "BATCH",
                                                               "update job set NextRunDate=null where id='" + ID + "' and JobTypeID=19");
                //BATCH
                DBHelper.executesqlandwritetocsvmultipletables(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "BATCH",
                                                               "select StatusID,ID from job where jobtypeid =19 and ID='" + ID + "'");
                JOBSTATUSID = ExcelHelper.Readcsvcolumnnamerownumberwise(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "StatusID", 1);
                //BATCH
                DBHelper.executesqlandwritetocsvmultipletables(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "BATCH",
                                                               "Select VoucherNumber,CustomerID,SalesItemID from SalesItem where customerid='" + customerid + "' and salesitemid='" + salesitemid + "'");
                BilledSalesItemid = ExcelHelper.Readcsvcolumnnamerownumberwise(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "SalesItemID", 1);
                LogHelper.WriteLog(ConfigReader.logFilePath, "BilledSalesItemid is :-" + BilledSalesItemid);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public static void SelectElementByIndexWitWait(By locator, int index)
        {
            WebDriverWait wait    = GetWebDriverWait(DriverContext.GetDriver <IWebDriver>(), TimeSpan.FromSeconds(60));
            IWebElement   element = wait.Until(ExpectedConditions.ElementIsVisible(locator));

            select = new SelectElement(element);
            select.SelectByIndex(index);
        }
 public static bool IsElemetPresent(By locator)
 {
     try
     {
         return(DriverContext.GetDriver <IWebDriver>().FindElements(locator).Count == 1);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public static IWebElement GetElement(By locator)
 {
     if (IsElemetPresent(locator))
     {
         return(DriverContext.GetDriver <IWebDriver>().FindElement(locator));
     }
     else
     {
         throw new NoSuchElementException("Element Not Found : " + locator.ToString());
     }
 }
        public static void TakeScreenShot(string filename = "Screen")
        {
            var screen = DriverContext.GetDriver <IWebDriver>().TakeScreenshot();

            if (filename.Equals("Screen"))
            {
                filename = filename + DateTime.UtcNow.ToString("yyyy-MM-dd-mm-ss") + ".jpeg";
                screen.SaveAsFile(filename, ScreenshotImageFormat.Jpeg);
                return;
            }
            screen.SaveAsFile(filename, ScreenshotImageFormat.Jpeg);
        }
        //  public void CreateTopLevelCustomerDetails(string LineOfBusiness,string Band)
        public void CreateTopLevelCustomerDetails()
        {
            int srow = ConfigReader.srow;
            int erow = ConfigReader.erow;

            for (int i = srow; i <= erow; i++)
            {
                try
                {
                    //var autoIT=new AutoItX3();
                    //IE
                    System.Diagnostics.Process.Start(@"D:\Shell Framework\AutomationFramework -Nunit - Parallel\AutomationFramework\Autoitscript\HandleAuthenticationWindow.exe");
                    DriverContext.GetDriver <IWebDriver>().Navigate().GoToUrl("http://ws08r2/gfnlaunch");

                    //chrome
                    //  DriverContext.GetDriver<IWebDriver>().Navigate().GoToUrl("http://*****:*****@ws08r2/gfnlaunch");

                    //var driverHandles = DriverContext.GetDriver<IWebDriver>().WindowHandles;
                    //var test = autoIT.Winactive;
                    //SendKeys.Send(@"code\shwet");

                    //   DriverContext.GetDriver<IWebDriver>() = GetChromeDriver();


                    DriverContext.InitDriver(_browsertype);
                    var    autoIT = new AutoItX3();
                    string title  = DriverContext.GetDriver <IWebDriver>().Title;

                    string testmethodname = TestContext.CurrentContext.Test.Name;

                    LogHelper.WriteLog(ConfigReader.logFilePath, "****************************");

                    LogHelper.WriteLog(ConfigReader.logFilePath, "Executing Test Case-> " + testmethodname);

                    LogHelper.WriteLog(ConfigReader.logFilePath, "****************************");


                    Customer c = new Customer();
                    c.selectcolco(ConfigReader.GetColco);

                    string customerERP = c.CreateCustomerDetails(ConfigReader.GetColco, i);


                    DriverContext.CloseDriver();
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message);
                }
            }
        }
 public static void IfElementExistsByXpath(string Xpathlocator, int wait)
 {
     try
     {
         WebDriverWait explicitwait = new WebDriverWait(DriverContext.GetDriver <IWebDriver>(), TimeSpan.FromSeconds(wait));
         explicitwait.PollingInterval = TimeSpan.FromMilliseconds(500);
         explicitwait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException));
         explicitwait.Until(ExpectedConditions.ElementExists(By.XPath(Xpathlocator)));
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
 }
 public static void ExplicitWaitByCss(string Csslocator, int wait)
 {
     try
     {
         WebDriverWait explicitwait = new WebDriverWait(DriverContext.GetDriver <IWebDriver>(), TimeSpan.FromSeconds(wait));
         explicitwait.PollingInterval = TimeSpan.FromMilliseconds(500);
         explicitwait.IgnoreExceptionTypes(typeof(NoSuchElementException));
         IWebElement element = explicitwait.Until(ExpectedConditions.ElementExists(By.CssSelector(Csslocator)));
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
 }
        public static bool SwitchToWindowWithTitle(String title)
        {
            IReadOnlyCollection <string> all_windowHandles = DriverContext.GetDriver <IWebDriver>().WindowHandles;

            // Set<String> windowHandles = driver.getWindowHandles();
            foreach (String handle in all_windowHandles)
            {
                DriverContext.GetDriver <IWebDriver>().SwitchTo().Window(handle);
                if (DriverContext.GetDriver <IWebDriver>().Title.Contains(title))
                {
                    break;
                }
            }
            return(true);
        }
 public static void FluentWaitforElement(By locator, int wait)
 {
     try
     {
         DefaultWait <IWebDriver> fluentwait = new DefaultWait <IWebDriver>(DriverContext.GetDriver <IWebDriver>());
         fluentwait.Timeout         = TimeSpan.FromSeconds(15);
         fluentwait.PollingInterval = TimeSpan.FromMilliseconds(500);
         fluentwait.IgnoreExceptionTypes(typeof(NoSuchElementException));
         IWebElement element = fluentwait.Until(ExpectedConditions.ElementExists(locator));
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
 }
 public static bool MouseHoverToElementandClickbylocator(By locator)
 {
     try
     {
         Thread.Sleep(15000);
         Actions action = new Actions(DriverContext.GetDriver <IWebDriver>());
         action.MoveToElement(DriverContext.GetDriver <IWebDriver>().FindElement(locator)).Click().Build().Perform();
         Thread.Sleep(15000);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     return(true);
 }
Esempio n. 15
0
        public void AddDriverToGroup(int groupid, int playerid, Driver driver)
        {
            DriverContext  driverContext  = new DriverContext();
            AccountContext accountContext = new AccountContext();
            Group          existingGroup  = context.GetGroupByID(groupid);

            Driver existingDriver = driverContext.GetDriver(driver.ID);
            Player existingPlayer = accountContext.GetPlayerByID(playerid);

            //Bestaat de group, driver en player
            if (existingGroup != null && existingDriver != null && existingPlayer != null)
            {
                //Bestaat de opgegeven driver niet al bestaat in de group
                //Heeft de player niet al een driver van het zelfde team in de groep staan
            }
        }
        // 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);
        }
Esempio n. 17
0
        public void ImplementInput(string input)
        {
            DriverContext dc = new DriverContext();

            switch (input)
            {
            case ">GetDriver":
                Console.WriteLine("Give driver id:");
                int            nr  = 0;
                ConsoleKeyInfo key = Console.ReadKey();
                Console.WriteLine();
                if (char.IsDigit(key.KeyChar))
                {
                    nr = int.Parse(key.KeyChar.ToString());     // use Parse if it's a Digit
                }
                Console.WriteLine(dc.GetDriver(nr));
                break;
            }
        }
        public static string WritetoDX026File(string datFilePath, string recordtype, string transacionid, string transactionlinenumber, string clientcompanynumber,
                                              string terminalnumber, string sitenumber, string sitename, string PANEntrymethod, string saleslocation, string ismanual, string PAN,
                                              string cardexpirydate, string salesdatetime, string transactioncurrencycode, string siteamountperunit, string siteamountgross, string siteamountvat,
                                              string productcode, string subproductcode, string subproductdescription, string productstockstatus, string quantity, string vouchernumber,
                                              string tranproviderid, string randomnumber)
        {
            DateTime NOW = DateTime.Now;

            LogHelper.WriteLog(ConfigReader.logFilePath, "DateTime is : " + NOW);
            DateTime oDateTime   = Convert.ToDateTime(NOW);
            string   DateTimenew = oDateTime.ToString("yyyyMMddmmss");
            string   Date        = DateTimenew.Substring(0, 8);
            string   Time        = DateTimenew.Substring(8, 6);

            LogHelper.WriteLog(ConfigReader.logFilePath, "Date is " + Date);
            LogHelper.WriteLog(ConfigReader.logFilePath, "Time   is " + Time);
            string FileTrailer = "T|DX026_GFN_TRX_" + tranproviderid + "_" + randomnumber + "_" + Date + "_" + Time + ".dat|" + quantity + "|" + siteamountgross;
            string datFileName = "DX026_GFN_TRX_" + tranproviderid + "_" + randomnumber + "_" + Date + "_" + Time;
            string file        = datFilePath + "\\" + datFileName + ".dat";

            if (!(File.Exists(file)))
            {
                using (StreamWriter sw = File.CreateText(file))
                {
                    sw.WriteLine(recordtype + "|" + transacionid + "|" + transactionlinenumber + "|" + clientcompanynumber + "|" + terminalnumber + "|" + sitenumber +
                                 "|" + sitename + "|" + PANEntrymethod + "|" + saleslocation + "|" + ismanual + "|" + PAN + "|" + cardexpirydate + "|" + salesdatetime + "|" +
                                 transactioncurrencycode + "|" + siteamountperunit + "|" + siteamountgross + "|" + siteamountvat + "|" + productcode + "|" + subproductcode +
                                 "|" + subproductdescription + "|" + productstockstatus + "|" + quantity + "|" + vouchernumber +
                                 "|||||y|additional 1|additional 2|additional 3|additional 4");
                    sw.WriteLine(FileTrailer);
                }
            }
            Thread.Sleep(246000);
            //BATCH
            DBHelper.executesqlandwritetocsvmultipletables(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "BATCH",
                                                           "select VoucherNumber,CustomerID,SalesItemID from SalesIemUnbilled where VoucherNumber='" + vouchernumber + "' and PAN='" + PAN + "'");
            Thread.Sleep(46000);
            string salesitemid = ExcelHelper.Readcsvcolumnnamerownumberwise(DriverContext.GetDriver <IWebDriver>(), ConfigReader.downloadFilepath, "sql", "SalesItemID", 1);

            return(salesitemid);
        }
        public void NavigatetoSearchPriceRule(string colconame)
        {
            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         = @"";
                    ExcelHelper eat              = new ExcelHelper(fileName);
                    string      strWorksheetName = eat.getExcelSheetName(fileName, 11);
                    int         rowcountofexcel  = eat.GetRowCount(strWorksheetName);
                    BrowserHelper.BrowserMaximize();
                    action.MoveToElement(Start).Build().Perform();
                    Thread.Sleep(2000);
                    action.MoveToElement(PricingandFees).Build().Perform();
                    Thread.Sleep(2000);
                    action.MoveToElement(SearchPriceRule).Click().Build().Perform();
                    Thread.Sleep(2000);
                }
            }
        }
 public Customer()
 {
     PageFactory.InitElements(DriverContext.GetDriver <IWebDriver>(), this);
 }
 public static IWebElement FindElementWithXpath(By locator)
 {
     return(DriverContext.GetDriver <IWebDriver>().FindElement(locator));
 }
 public static IWebElement FindElementWithXpath(string xpath)
 {
     return(DriverContext.GetDriver <IWebDriver>().FindElement(By.XPath(xpath)));
 }
Esempio n. 23
0
        public static object ExecuteScript(string script, params object[] args)
        {
            IJavaScriptExecutor executor = ((IJavaScriptExecutor)DriverContext.GetDriver <IWebDriver>());

            return(executor.ExecuteScript(script, args));
        }
Esempio n. 24
0
        public static void TypeInTextBoxusingJavaScript(string id, string text)
        {
            IJavaScriptExecutor executor = (IJavaScriptExecutor)DriverContext.GetDriver <IWebDriver>();

            executor.ExecuteScript("document.getElementById(id).value='text'");
        }
 public static void Click(By locator)
 {
     DriverContext.GetDriver <IWebDriver>().FindElement(locator).Click();
 }
        public static void JavaScriptClick(IWebElement element)
        {
            IJavaScriptExecutor executor = (IJavaScriptExecutor)DriverContext.GetDriver <IWebDriver>();

            executor.ExecuteScript("argument[0].click();", element);
        }
Esempio n. 27
0
 public SigIn()
 {
     PageFactory.InitElements(DriverContext.GetDriver <IWebDriver>(), this);
 }
 public static void WaitTime()
 {
     WebDriverWait webDriverWait = new WebDriverWait(DriverContext.GetDriver <IWebDriver>(), TimeSpan.FromSeconds(60));
 }
Esempio n. 29
0
 public static void ClearandTypeinTextBox(By locator, string text)
 {
     DriverContext.GetDriver <IWebDriver>().FindElement(locator).Clear();
     Thread.Sleep(3000);
     DriverContext.GetDriver <IWebDriver>().FindElement(locator).SendKeys(text);
 }
 //use these
 public static void WaitforElement(By locator, int wait)
 {
     WebDriverWait w       = new WebDriverWait(DriverContext.GetDriver <IWebDriver>(), TimeSpan.FromSeconds(wait));
     IWebElement   element = w.Until(ExpectedConditions.ElementIsVisible(locator));
 }