Exemplo n.º 1
0
        //DRIVERS SPECIAL CONSTRUCTORS FOR SPECIFIC PORTS ON HOST MACHINE
        //(NOT USING RIGHT NOW)
        private static IWebDriver GetNewFirefoxDriver(int driverPort)
        {
            //setup driver's port
            FirefoxProfile profile = new FirefoxProfile();

            profile.Port = driverPort;

            TestsLogger.Debug("Attempting to start Firefox browser on port " + profile.Port);
            return(new FirefoxDriver(profile));
        }
Exemplo n.º 2
0
        private static IWebDriver GetNewChromeDriver(string driverPath, int driverPort)
        {
            //setup driver's folder and port
            var chromeDriverService = ChromeDriverService.CreateDefaultService(driverPath);

            chromeDriverService.Port = driverPort;

            TestsLogger.Debug("Attempting to start Chrome browser on port " + driverPort);
            return(new ChromeDriver(chromeDriverService));
        }
Exemplo n.º 3
0
        private static IWebDriver GetNewInternetExplorerDriver(string driverPath, int driverPort)
        {
            //setup driver's folder and port
            var IEDriverService = InternetExplorerDriverService.CreateDefaultService(driverPath);

            IEDriverService.Port = driverPort;

            //Ignore browser security warning
            var options = new InternetExplorerOptions();

            options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

            //This property could be useful to fix scroll issues
            //?options.ElementScrollBehavior = 1;

            options.RequireWindowFocus = false;

            //ensure a clean session on browser startup and use private mode
            options.EnsureCleanSession = true;

            TestsLogger.Debug("Attempting to start IE browser on port " + (driverPort + 1));
            return(new InternetExplorerDriver(IEDriverService, options));
        }
Exemplo n.º 4
0
        private BankTransactionData CreateBankTrxFromWebElement(IWebElement trxWE)
        {
            BankTransactionData transaction = new BankTransactionData();

            //get claim id to replace on id locators
            string trxNumberId = trxWE.FindElement(By.XPath(".//p[contains(@id,'transactionSerialNumber-')]")).GetAttribute("id");

            trxNumberId = trxNumberId.Replace("transactionSerialNumber-", "");

            int trxId = Convert.ToInt32(trxNumberId);

            transaction.Id = trxId;

            TestsLogger.Debug("Getting data from UI for Transaction with Id=" + trxId);

            //Corner Tag color
            IWebElement cornerTagWE = trxWE.FindElement(By.Id(String.Format(TRX_CORNER_TAG_BY_ID_LOCATOR_TEMPLATE, trxId)));

            transaction.CornerTagColor = this.GetColorFromColorCode(cornerTagWE.FindElement(By.TagName("polygon")).GetCssValue("fill"));

            //TRX Type Box
            transaction.TypeBoxColor      = this.GetColorFromColorCode(trxWE.FindElement(By.Id(String.Format(TRX_TYPE_BOX_BY_ID_LOCATOR_TEMPLATE, trxId))).GetCssValue("background-color"));
            transaction.TransactionNumber = trxWE.FindElement(By.Id(String.Format(TRX_NUMBER_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;

            //Name
            transaction.Name = trxWE.FindElement(By.Id(String.Format(TRX_NAME_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;

            //Description
            transaction.Description = trxWE.FindElement(By.Id(String.Format(TRX_DESCRIPTION_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;


            //TRX Date
            transaction.TrxDateLabel = trxWE.FindElement(By.Id(String.Format(TRX_DATE_LABEL_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;
            transaction.TrxDate      = trxWE.FindElement(By.Id(String.Format(TRX_DATE_VALUE_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;

            //Cleared Date
            transaction.ClearedDateLabel = trxWE.FindElement(By.Id(String.Format(TRX_CLEARED_DATE_LABEL_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;
            IWebElement clearedDateValueWE = trxWE.FindElement(By.Id(String.Format(TRX_CLEARED_DATE_VALUE_BY_ID_LOCATOR_TEMPLATE, trxId)));

            transaction.ClearedDate     = clearedDateValueWE.Text;
            transaction.ClaredDateColor = this.GetColorFromColorCode(clearedDateValueWE.GetCssValue("color"));

            //Code
            transaction.CodeLabel = trxWE.FindElement(By.Id(String.Format(TRX_CODE_LABEL_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;
            transaction.Code      = trxWE.FindElement(By.XPath(String.Format(TRX_CODE_VALUE_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;

            //Amount
            transaction.AmountLabel = trxWE.FindElement(By.Id(String.Format(TRX_AMOUNT_LABEL_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;
            transaction.AmountValue = trxWE.FindElement(By.Id(String.Format(TRX_AMOUNT_VALUE_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;

            //Balance
            transaction.BalanceLabel = trxWE.FindElement(By.Id(String.Format(TRX_BALANCE_LABEL_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;
            transaction.BalanceValue = trxWE.FindElement(By.Id(String.Format(TRX_BALANCE_VALUE_BY_ID_LOCATOR_TEMPLATE, trxId))).Text;

            //Set claim links data for Check Trx
            if (transaction.TransactionNumber.Contains("Check #"))
            {
                this.GetClaimLinksDataForTransaction(trxId, trxWE, transaction);
            }
            else if (transaction.TransactionNumber.Contains("Deposit"))
            {
                //Set asset links data for Deposit Trx
                this.GetAssetLinksDataForTransaction(trxId, trxWE, transaction);
            }

            return(transaction);
        }