Exemple #1
0
        //[BeforeFeature()]
        public static void InitWebdriver(TestContext tc)
        {
            ObjectRepository.Config = new AppConfigReader();

            switch (ObjectRepository.Config.GetBrowser())
            {
            //case BrowserType.Firefox:
            //    ObjectRepository.Driver = GetFirefoxDriver();
            //    Logger.Info(" Using Firefox Driver  ");

            //    break;

            case BrowserType.Chrome:
                ObjectRepository.Driver = GetChromeDriver();
                Logger.Info(" Using Chrome Driver  ");
                break;

            case BrowserType.IExplorer:
                ObjectRepository.Driver = GetIEDriver();
                Logger.Info(" Using Internet Explorer Driver  ");
                break;

            //case BrowserType.PhantomJs:
            //    ObjectRepository.Driver = GetPhantomJsDriver();
            //    Logger.Info(" Using PhantomJs Driver  ");
            //    break;

            default:
                throw new NoSuitableDriverFound("Driver Not Found : " + ObjectRepository.Config.GetBrowser().ToString());
            }
            ObjectRepository.Driver.Manage()
            .Timeouts().PageLoad = TimeSpan.FromSeconds(ObjectRepository.Config.GetPageLoadTimeOut());
            ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeOut());
            BrowserHelper.BrowserMaximize();
        }
Exemple #2
0
        public void NavigatetoSearchPriceRule(string colconame)
        {
            Actions action = new Actions(DriverContext.Driver);
            IReadOnlyCollection <string> all_windowHandles = DriverContext.Driver.WindowHandles;

            foreach (string handle in all_windowHandles)
            {
                DriverContext.Driver.SwitchTo().Window(handle);

                if (DriverContext.Driver.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);
                }
            }
        }
Exemple #3
0
        //[AssemblyInitialize]
        public static void InitWebdriver(TestContext tc)
        {
            ObjectRepository.Config = new AppConfigReader();
            //Reporter.GetReportManager();
            //Reporter.AddTestCaseMetadataToHtmlReport(tc);
            String browserName = ConfigurationManager.AppSettings.Get("Browser");

            switch (browserName)
            {
            case "Firefox":
                ObjectRepository.Driver = GetFirefoxDriver();
                break;

            case "Chrome":
                ObjectRepository.Driver = GetChromeDriver();
                Logger.Info(" Using Chrome Driver  ");
                break;

            case "IExplorer":
                ObjectRepository.Driver = GetIEDriver();
                break;



            default:
                throw new NoSutiableDriverFound("Driver Not Found : " + ObjectRepository.Config.GetBrowser().ToString());
            }
            ObjectRepository.Driver.Manage()
            .Timeouts().PageLoad = TimeSpan.FromSeconds(ObjectRepository.Config.GetPageTimeOutTime());
            ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeout());
            BrowserHelper.BrowserMaximize();
        }
        public static void InitWebdriver(TestContext tc)
        {
            ObjectRepository.Config = new AppConfigReader();
            switch (ObjectRepository.Config.GetBrowser())
            {
            case BrowserType.Firefox:
                ObjectRepository.Driver = GetFirefoxDriver();
                break;

            case BrowserType.Chrome:
                ObjectRepository.Driver = GetChromeDriver();
                break;

            case BrowserType.IExplorer:
                ObjectRepository.Driver = GetIExplorerDriver();
                break;

            default:
                throw new NoSuitableDriverFound("No suitable driver found for {0}" + ObjectRepository.Config.GetBrowser());
            }
            NavigationHelper.NavigationToURL(ObjectRepository.Config.GetWebsite());
            //PageLoad is the timeout when loading a page
            ObjectRepository.Driver.Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(ObjectRepository.Config.GetPageLoadTimeout());
            ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeout());
            BrowserHelper.BrowserMaximize();
        }
Exemple #5
0
        //[BeforeFeature()]
        public static void InitWebdriver(TestContext tc)
        {
            ObjectRepository.Config = new AppConfigReader();

            switch (ObjectRepository.Config.GetBrowser())
            {
            case BrowserType.Firefox:
                ObjectRepository.Driver = GetFirefoxDriver();
                break;

            case BrowserType.Chrome:
                ObjectRepository.Driver = GetChromeDriver();
                break;

            case BrowserType.IExplorer:
                ObjectRepository.Driver = GetIEDriver();
                break;

            case BrowserType.PhantomJs:
                ObjectRepository.Driver = GetPhantomJsDriver();
                break;

            default:
                throw new NoSutiableDriverFound("Driver Not Found : " + ObjectRepository.Config.GetBrowser().ToString());
            }
            ObjectRepository.Driver.Manage()
            .Timeouts()
            .SetPageLoadTimeout(TimeSpan.FromSeconds(ObjectRepository.Config.GetPageLoadTimeOut()));
            ObjectRepository.Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeOut()));
            BrowserHelper.BrowserMaximize();
        }
 public void TestActions()
 {
     NavigationHelper.NavigateToUrl("https://google.com");
     BrowserHelper.BrowserMaximize();
     TextBoxHelper.TypeInTextBox(By.XPath("//input[@title='Search']"), "My Name");
     BrowserHelper.GoBack();
     BrowserHelper.Forward();
     BrowserHelper.RefreshPage();
 }
Exemple #7
0
        // [AssemblyInitialize]
        //[BeforeFeature()]
        public static void InitWebdriver(string browser)
        {
            ObjectRepository.Config = new AppConfigReader();

            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability(CapabilityType.BrowserName, browser);
            ObjectRepository.Driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities, TimeSpan.FromSeconds(600));

            BrowserHelper.BrowserMaximize();
        }
Exemple #8
0
        public static void Initialize(string browser)
        {
            DesiredCapabilities caps = new DesiredCapabilities();

            caps.SetCapability(CapabilityType.BrowserName, browser);
            // caps.SetCapability(CapabilityType.Version, version);
            //caps.SetCapability(CapabilityType.Platform, os);


            Instance = (browser == "internet explorer")? GetIERemoteDriver():new RemoteWebDriver(new Uri(serverUrl), caps, TimeSpan.FromSeconds(600));

            BrowserHelper.BrowserMaximize();
            // TurnOnWait();
        }
Exemple #9
0
        public void InitWebdriver()
        {
            ObjectRepository.Config = new AppConfigReader();



            switch (ObjectRepository.Config.GetBrowser())
            {
            case BrowserType.Firefox:
                ObjectRepository.Driver = GetFirefoxDriver();
                break;

            case BrowserType.Chrome:
                ObjectRepository.Driver = GetChromeDriver();
                break;

            case BrowserType.IE:
                ObjectRepository.Driver = GetIEDriver();
                break;

            case BrowserType.PhantomJs:
                ObjectRepository.Driver = GetPhantomJsDriver();
                break;

            default:
                throw new NoSuitableBrowserFoundException("Driver Not Found : " + ObjectRepository.Config.GetBrowser().ToString());
            }


            //  DesiredCapabilities capabilities = new DesiredCapabilities();
            //capabilities.SetCapability(CapabilityType.BrowserName, browser);



            //  ObjectRepository.Driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities, TimeSpan.FromSeconds(600));
            //  BrowserHelper.BrowserMaximize();



            //ObjectRepository.Driver.Manage()
            //    .Timeouts()
            //    .SetPageLoadTimeout(TimeSpan.FromSeconds(ObjectRepository.Config.GetPageLoadTimeOut()));
            //ObjectRepository.Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeOut()));
            BrowserHelper.BrowserMaximize();
        }
Exemple #10
0
        //[BeforeFeature()]
        public static void InitWebdriver(TestContext tc)
        {
            ObjectRepository.Config = new AppConfigReader();
            Reporter.GetReportManager();
            Reporter.AddTestCaseMetadataToHtmlReport(tc);
            switch (ObjectRepository.Config.GetBrowser())
            {
            case BrowserType.Firefox:
                ObjectRepository.Driver = GetFirefoxDriver();
                Logger.Info(" Using Firefox Driver  ");

                break;

            case BrowserType.Chrome:
                ObjectRepository.Driver = GetChromeDriver();
                Logger.Info(" Using Chrome Driver  ");
                break;

            case BrowserType.IExplorer:
                ObjectRepository.Driver = GetIEDriver();
                Logger.Info(" Using Internet Explorer Driver  ");
                break;

            // Deprecated
            case BrowserType.PhantomJs:
                //ObjectRepository.Driver = GetPhantomJsDriver();
                Logger.Info(" Using PhantomJs Driver  ");
                break;

            case BrowserType.Edge:
                ObjectRepository.Driver = GetEdgeDriver();
                Logger.Info(" Using Edge Driver  ");
                break;

            default:
                throw new NoSutiableDriverFound("Driver Not Found : " + ObjectRepository.Config.GetBrowser().ToString());
            }
            ObjectRepository.Driver.Manage().Cookies.DeleteAllCookies();
            ObjectRepository.Driver.Manage()
            .Timeouts().PageLoad = TimeSpan.FromSeconds(ObjectRepository.Config.GetPageLoadTimeOut());
            ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeOut());
            ObjectRepository.Driver.Manage().Cookies.DeleteAllCookies();
            BrowserHelper.BrowserMaximize();
        }
        // 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);
        }
Exemple #13
0
        //[BeforeFeature()]
        public static void InitWebdriver(TestContext tc)
        {
            ObjectRepository.Config = new AppConfigReader();

            switch (ObjectRepository.Config.GetBrowser())
            {
            case BrowserType.Firefox:
                ObjectRepository.Driver = GetFirefoxDriver();

                break;

            case BrowserType.Chrome:
                ObjectRepository.Driver = GetChromeDriver();
                break;

            case BrowserType.IExplorer:
                ObjectRepository.Driver = GetIEDriver();
                break;
            }
            ObjectRepository.Driver.Manage()
            .Timeouts().PageLoad = TimeSpan.FromSeconds(ObjectRepository.Config.GetPageLoadTimeOut());
            ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ObjectRepository.Config.GetElementLoadTimeOut());
            BrowserHelper.BrowserMaximize();
        }
Exemple #14
0
        public static void InitilaizeDriver(string BrowserName)
        {
            switch (BrowserName)
            {
            case "Firefox":
                webDriver = GetFirefoxDriver();

                break;

            case "Chrome":
                webDriver = GetChromeDriver();
                break;

            case "IExplorer":
                webDriver = GetIEDriver();
                break;
            }
            //specify the page load timeout duration
            webDriver.Manage()
            .Timeouts().PageLoad = TimeSpan.FromSeconds(Convert.ToDouble(ConfigurationManager.AppSettings.Get("PageLoadTimeout")));
            //specify the element load timeout duration
            webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Convert.ToDouble(ConfigurationManager.AppSettings.Get("ElementLoadTimeout")));
            BrowserHelper.BrowserMaximize();
        }