示例#1
0
        internal void ClickMyAccountLink()
        {
            Driver.FindElement(By.XPath("//*[@type='accountUnfilled']")).Click();

            InitiateWaitVariable();
            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@data-testid='myaccount-link']"))).Click();
        }
示例#2
0
        public void ThenThePageShouldChangeToUKVersion()
        {
            new WebDriverWait(sel.Driver, TimeSpan.FromSeconds(3000)).Until(ExpectedConditions.TextToBePresentInElement(sel.Driver.FindElement(By.XPath("//div/span/span")), "United Kingdom"));
            String currentURL = sel.Driver.Url;

            Assert.AreEqual(currentURL, "https://www.ubs.com/uk/en.html");
        }
示例#3
0
        public bool waitForVisibilityOfElementUntillTimeout(By lookupBy, double timeout)
        {
            bool          bln  = false;
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));

            try
            {
                WebElement ele = wait.Until(ExpectedConditions.ElementIsVisible(lookupBy));//sunil
                bln = true;
            }
            catch (Exception ex)
            {
                try
                {
                    TakeScreenShot();
                    Assert.Fail(lookupBy + " is not visible for " + timeout + " seconds." + " with message :" + ex.Message);
                    throw new Exception(ex.Message);
                }
                catch (Exception ex1)
                {
                    Assert.Fail("Failed to take screenshot: " + ex1.ToString());
                }
            }

            return(bln);
        }
示例#4
0
        public bool waitForVisibilityOfElement(By lookupBy, double timeout)
        {
            bool          flag = false;
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));

            try
            {
                WebElement ele = wait.Until(ExpectedConditions.ElementIsVisible(lookupBy));
                flag = true;
                ExtentReport.ReportPass("The element is visible before <b>" + timeout + "</b> seconds");
            }
            catch (Exception ex)
            {
                try
                {
                    //TakeScreenShot();
                    ExtentReport.ReportFail("The element is not visible :<b>" + ex.Message + "</b>");
                    //Assert.Fail(lookupBy + " is not visible for " + timeout + " seconds." + " with message :" + ex.Message);
                    flag = false;
                }
                catch (Exception ex1)
                {
                    //Assert.Fail("Failed to take screenshot: " + ex1.ToString());
                }
            }

            return(flag);
        }
示例#5
0
        internal EasyReturnsPage ClickEasyReturnsLink()
        {
            InitiateWaitVariable();
            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//p[contains(text(),'Easy')]"))).Click();

            return(new EasyReturnsPage(Driver));
        }
        /*
         * Enter text in the textbox
         */

        void IActionsVisitor.visitTextBox(ArcliteTextBox element, InputVal wanted)
        {
            string      text = wanted.getSelectedVal();
            IWebElement input;
            long        number     = 0;
            bool        canConvert = long.TryParse(text, out number);

            if (element._secondXPath == null)
            {
                try
                {
                    input = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element.elementXPath)));
                    new ArcliteButton("", element.elementXPath).accept(this, new InputVal());
                }
                catch (WebDriverTimeoutException)
                {
                    input = driver.FindElement(By.XPath(element.elementXPath));
                }
            }
            else
            {
                input = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element.elementXPath + wanted.valTwo + element._secondXPath)));
                new ArcliteButton("", element.elementXPath + wanted.valTwo + element._secondXPath).accept(this, new InputVal());
            }
            if (canConvert)
            {
                input.Clear();
                input.SendKeys(text);
            }
            else
            {
                driver.ExecuteJavaScript("arguments[0].value = '" + text + "';", input);
            }
        }
示例#7
0
        public void clickWhenReady(By locator, int timeout)
        {
            WebDriverWait wait    = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));
            WebElement    element = wait.Until(ExpectedConditions.ElementToBeClickable(locator));

            element.Click();
        }
        /*
         * Performs a click on a button
         */

        void IActionsVisitor.visitButton(ArcliteButton element)
        {
            IWebElement e;

            try
            {
                e = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element._elementXPath)));
            }
            catch (ElementNotVisibleException eve)
            {
                throw eve;
            }
            try
            {
                e.Click();
            }
            catch (ElementClickInterceptedException)
            {
                driver.ExecuteJavaScript("arguments[0].click();", e);
            }
            catch (StaleElementReferenceException)
            {
                driver.ExecuteJavaScript("arguments[0].click();", e);
            }
        }
示例#9
0
        internal void ClickJoinLink()
        {
            Driver.FindElement(By.XPath("//*[@type='accountUnfilled']")).Click();

            InitiateWaitVariable();
            //var wait = new WebDriverWait(Driver,TimeSpan.FromSeconds(5));
            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@data-testid='signup-link']"))).Click();
        }
示例#10
0
        //[Ignore("Ignore a test")]
        public void ExecuteReposytoryCreation()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

            Assert.Multiple(() =>
            {
                Assert.AreEqual(driver.Title, "GitHub", "Page title is incorrect");
                Assert.IsTrue(driver.FindElement(By.XPath("//a[@class='btn shelf-cta mx-2 mb-3']")).Text.Equals("Start a project"), "Button 'SP' is absent");
                Assert.IsTrue(driver.FindElement(By.XPath("//a[@class='btn btn-primary shelf-cta mx-2 mb-3']")).Displayed, "Block 'Read the guide' is absent");
            });

            Log.Information("Third block of Asserts is passed");

            RepositoryCreator repositoryCreator1 = new RepositoryCreator();

            PageFactory.InitElements(driver, repositoryCreator1);
            repositoryCreator1.startProjectButton.Click();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(driver.Title, "Create a New Repository", "Incorrect page title");
                Assert.IsTrue(driver.FindElement(By.XPath("//input[@id='repository_visibility_public']")).Selected, "Check-box 'Public' is NOT selected");
                Assert.IsFalse(driver.FindElement(By.XPath("//input[@id='repository_visibility_private']")).Selected, "Check-box 'Private' is selected");
                Assert.IsFalse(driver.FindElement(By.XPath("//input[@id='repository_auto_init']")).Selected, "Check-box 'ReadME' is selected");
                Assert.IsTrue(driver.FindElement(By.XPath("//button[@class='btn btn-primary first-in-line']")).Displayed, "Button 'Create Repository' is absent");
            });

            Log.Information("Forth block of Asserts is passed");

            bool selection = driver.FindElement(By.XPath("//input[@id='repository_name']")).Displayed &&
                             driver.FindElement(By.XPath("//input[@id='repository_description']")).Displayed &&
                             driver.FindElement(By.XPath("//input[@id='repository_auto_init']")).Displayed;

            switch (selection)
            {
            case true:
                repositoryCreator1.typeRepositoryName.SendKeys(RepositoryName);
                repositoryCreator1.typeDescription.SendKeys(Description);
                repositoryCreator1.readMeRadioButton.Click();
                IWebElement createButton =
                    wait.Until(ExpectedConditions.ElementToBeClickable(
                                   By.XPath("//button[@class='btn btn-primary first-in-line']")));
                repositoryCreator1.createRepositoryButton.Click();

                Log.Information("Repository is created successfully! Time is {Now}", DateTime.Now);
                Thread.Sleep(2000);
                break;

            case false:
                Log.Information("Fail of Repository Creation! Time is {Now}", DateTime.Now);
                break;

            default:
                Log.Information("That's impossible!");
                break;
            }
        }
示例#11
0
        internal void ClickContactPreferencesLink()
        {
            InitiateWaitVariable();

            var acctMsg = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@data-testid='myAccountIcon']")));

            acctMsg.Click();

            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@data-testid='contactpreferences-link']"))).Click();
        }
示例#12
0
        internal ReturnsInformationPage ClickReturnsInformationLink()
        {
            InitiateWaitVariable();
            var acctMsg = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@data-testid='myAccountIcon']")));

            acctMsg.Click();
            var returnsLink = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@data-testid='returnsinformation-link']")));

            returnsLink.Click();

            return(new ReturnsInformationPage(Driver));
        }
示例#13
0
        //[Ignore("Ignore a test")]

        public void ExecuteFileCreation()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

            Assert.Multiple(() =>
            {
                Assert.IsTrue(driver.FindElement(By.XPath("//h2[@class='shelf-title']")).Text.Equals("Learn Git and GitHub without any code!"), "Incorrect main title");
                Assert.IsTrue(driver.FindElement(By.XPath("//span[@class='text-gray-dark mr-2']")).Text.Equals(Description), "Incorrect Description of repository");
                Assert.IsTrue(driver.FindElement(By.XPath("//button[@class='btn btn-sm BtnGroup-item']")).Displayed, "Button 'Create New File' is absent");
            });

            Log.Information("Fifth block of Asserts is passed");

            FileCreator fileCreator1 = new FileCreator();

            PageFactory.InitElements(driver, fileCreator1);
            fileCreator1.clickCreateFile.Click();

            Assert.Multiple(() =>
            {
                Assert.IsTrue(driver.FindElement(By.XPath("//a[@class='Header-link']//*[local-name()='svg']")).Displayed, "The Button 'CommitButton' is absent");
                Assert.IsTrue(driver.FindElement(By.XPath("//div[contains(@class,'form-checkbox pl-4 mt-0 mb-2')]//label[1]/input")).Selected, "Check-box 'Commit directly to the master branch' is NOT selected");
                Assert.IsFalse(driver.FindElement(By.XPath("//div[contains(@class,'form-checkbox pl-4 my-0')]//label[1]/input")).Selected, "Check-box 'Create a new branch for this commit and start a pull request' is NOT selected");
                Assert.IsTrue(driver.FindElement(By.XPath("//a[contains(@class,'btn btn-danger flex-auto text-center mx-3 mx-md-0')]")).Enabled, "The Button 'CANCEL' is NOT selected");
            });

            Log.Information("Sixth block of Asserts is passed");

            if (
                driver.FindElement(By.XPath("//input[@placeholder='Name your file…']")).Displayed &&
                driver.FindElement(By.XPath("//pre[contains(@class,'CodeMirror-line')]")).Displayed &&
                driver.FindElement(By.XPath("//input[@id='commit-summary-input']")).Displayed &&
                driver.FindElement(By.XPath("//textarea[@id='commit-description-textarea']")).Displayed
                )
            {
                fileCreator1.typeNameFile.SendKeys(NameFile);
                fileCreator1.typeBodyFile.SendKeys(BodyFile);
                fileCreator1.typeCommitFile.SendKeys(CommitFile);
                fileCreator1.typeCommitDescription.SendKeys(CommitDescription);
                fileCreator1.clickCommitButton.Click();
                IWebElement logoButton =
                    wait.Until(ExpectedConditions.ElementToBeClickable(
                                   By.XPath("//a[@class='Header-link']//*[local-name()='svg']")));
                fileCreator1.clickLogo.Click();

                Log.Information("File Creation process is executed successfully! Time is {Now}", DateTime.Now);
            }
            else
            {
                Log.Error("Elements are absent!Time is {Now}", DateTime.Now);
            }
        }
示例#14
0
 public static IWebElement WaitUntilElementClickable(IWebElement element, int timeout = 30)
 {
     try
     {
         var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));
         return(wait.Until(ExpectedConditions.ElementToBeClickable(element)));
     }
     catch (NoSuchElementException)
     {
         Console.WriteLine("Element with locator: '" + element + "' was not found in current context page.");
         throw;
     }
 }
 public bool FIndElementIsPresent(By by)
 {
     try
     {
         var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
         wait.Until(ExpectedConditions.ElementIsVisible(by));
         return(true);
     }
     catch (NoSuchElementException)
     {
         return(false);
     }
 }
示例#16
0
        internal void ClickGoogleLinkAndFillInformation()
        {
            InitiateWaitVariable();
            wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//span[contains(text(),'Google')]"))).Click();

            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@type='email']"))).SendKeys("*****@*****.**");

            Driver.FindElement(By.XPath("//*[@class='VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc qIypjc TrZEUc lw1w4b']")).Click();

            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@type='password']"))).SendKeys("lordNikon");

            Driver.FindElement(By.XPath("//*[@class='VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc qIypjc TrZEUc lw1w4b']")).Click();

            bool isAcctCreated;

            try
            {
                var acctCreated = wait.Until(ExpectedConditions.ElementExists(By.XPath("//span[contains(text(),'Hi Yavor')]"))).Enabled;
                isAcctCreated = Convert.ToBoolean(acctCreated);
            }
            catch (WebDriverTimeoutException exc)
            {
                Console.WriteLine(exc.Message);
                isAcctCreated = false;
            }

            if (isAcctCreated)
            {
                var myAcct = Driver.FindElement(By.XPath("//span[@type='accountFilled']"));
                myAcct.Click();

                var acctName = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[contains(text(),'Hi Yavor')]"))).Text;

                Console.WriteLine("You have already registered account with this name: " + acctName);
            }
            else
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.Id("BirthDay"))).Click();

                Driver.FindElement(By.XPath("//option[@value='27']")).Click();
                Driver.FindElement(By.Id("BirthMonth")).Click();
                Driver.FindElement(By.XPath("//option[contains(text(),'January')]")).Click();
                Driver.FindElement(By.Id("BirthYear")).Click();
                Driver.FindElement(By.XPath("//option[@value='1982']")).Click();
                Driver.FindElement(By.XPath("//label[contains(text(),'Menswear')]")).Click();
                Driver.FindElement(By.Id("promosLabel")).Click();
                Driver.FindElement(By.Id("newnessLabel")).Click();
                Driver.FindElement(By.Id("register")).Click();
            }
        }
示例#17
0
        internal ContactPreferencesPage ClickGoogleToLogIn()
        {
            InitiateWaitVariable();
            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[contains(text(),'Google')]"))).Click();

            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@type='email']"))).SendKeys("*****@*****.**");
            Driver.FindElement(By.XPath("//*[@class='VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc qIypjc TrZEUc lw1w4b']")).Click();

            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@type='password']"))).SendKeys("lordNikon");

            Driver.FindElement(By.XPath("//*[@class='VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc qIypjc TrZEUc lw1w4b']")).Click();

            return(new ContactPreferencesPage(Driver));
        }
        /*
         * gets the value from a textbox
         */

        string IActionsVisitor.getValue(ArcliteTextBox textbox)
        {
            IWebElement input;

            try
            {
                input = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(textbox.elementXPath)));
            }
            catch (WebDriverTimeoutException)
            {
                input = driver.FindElement(By.XPath(textbox.elementXPath));
            }
            string res = input.GetAttribute("value");

            return(res);
        }
示例#19
0
        public void CuandoSeArriesgaLaPalabraAutomaticamente()
        {
            var waitMostrarPalabraAAdivinar = new WebDriverWait(chromeDriver, System.TimeSpan.FromSeconds(10));

            waitMostrarPalabraAAdivinar.Until(ExpectedConditions.ElementIsVisible(By.Id("ButtonFlagPalabraAAdivinar")));
            var botonMostrarPalabraAAdivinar = chromeDriver.FindElementById("ButtonFlagPalabraAAdivinar");

            botonMostrarPalabraAAdivinar.Click();

            var waitPalabraAAdivinar = new WebDriverWait(chromeDriver, System.TimeSpan.FromSeconds(10));

            waitPalabraAAdivinar.Until(ExpectedConditions.ElementIsVisible(By.Id("PalabraAAdivinar")));
            var textoPalabraAAdivinar = chromeDriver.FindElementById("PalabraAAdivinar");

            CuandoSeArriesgaLaPalabra(textoPalabraAAdivinar.Text);
            Thread.Sleep(TimeSpan.FromSeconds(2));
        }
示例#20
0
        public bool waitForInVisibilityOfElement(By by, string locator)
        {
            bool          flag = false;
            TimeSpan      time = new TimeSpan(30);
            WebDriverWait wait = new WebDriverWait(driver, time);

            try
            {
                wait.Until(ExpectedConditions.InvisibilityOfElementLocated(by));
                flag = true;
                return(flag);
            }
            catch (Exception)
            {
                return(flag);
            }
        }
示例#21
0
        public void LogintoMyPage(LoginSelectorsModel loginCssSelectors, string username, string password, string partername)
        {
            Console.WriteLine(partername);
            _logger.Debug("trying to login ");
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5));

            if (partername != "AdjaraBet")
            {
                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(loginCssSelectors.LoginFormBtn)));
                driver.FindElement(By.CssSelector(loginCssSelectors.LoginFormBtn)).Click();
            }
            driver.FindElement(By.CssSelector(loginCssSelectors.UserNameInput)).SendKeys(username);
            driver.FindElement(By.CssSelector(loginCssSelectors.PasswordInput)).SendKeys(password);
            driver.FindElement(By.CssSelector(loginCssSelectors.LoginBtn)).Click();

            Thread.Sleep(1000);
        }
示例#22
0
        public void ExecuteLogin()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

            Assert.Multiple(() =>
            {
                Assert.IsTrue(driver.Url.Equals(screenUrl), "URL is incorrect");
                Assert.AreEqual(driver.Title, "The world’s leading software development platform · GitHub", "Page title is incorrect");
                Assert.IsTrue(driver.FindElement(By.XPath("//a[@class='HeaderMenu-link no-underline mr-3']")).Displayed, "Button 'Sign In' is absent");
            });
            Log.Information("First block of Asserts is passed");

            LoginPage loginPage = new LoginPage();

            PageFactory.InitElements(driver, loginPage);


            loginPage.firstButton.Click();
            wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@name='commit']")));

            Assert.Multiple(() =>
            {
                Assert.AreEqual(driver.Title, "Sign in to GitHub · GitHub", "Page title is incorrect");
                Assert.IsTrue(driver.FindElement(By.XPath("//a[@class='label-link']")).Text.Equals("Forgot password?"), "Button 'FP' is absent");
                Assert.IsTrue(driver.FindElement(By.XPath(" //p[@class='create-account-callout mt-3']")).Displayed, "Block 'CA' is absent");
            });

            Log.Information("Second block of Asserts is passed");

            if (
                driver.FindElement(By.XPath("//input[@name='commit']")).Displayed &&
                driver.FindElement(By.XPath("//input[@id='login_field']")).Displayed &&
                driver.FindElement(By.XPath("//input[@id='password']")).Displayed
                )
            {
                loginPage.typeEmail.SendKeys(emailLogin);
                loginPage.typePassword.SendKeys(passwordLogin);
                loginPage.signInButton.Click();
                Log.Information("Login process is executed successfully! Time is {Now}", DateTime.Now);
            }
            else
            {
                Log.Error("Expected elements are absent!Time is {Now}", DateTime.Now);
            }
        }
        /*
         * Enter text in a search box and clicks on search button if there is one
         */

        void IActionsVisitor.visitSearch(ArcliteSearch arcliteSearch, InputVal wanted)
        {
            if (arcliteSearch._searchButtonXpath == null)
            {
                IArcliteWebElement search = new ArcliteTextBox("", arcliteSearch._searchInputXPath);
                search.accept(this, wanted);
                IWebElement webElement;
                webElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(search.elementXPath)));
                webElement.SendKeys(Keys.Enter);
            }
            else
            {
                IArcliteWebElement search = new ArcliteTextBox("", arcliteSearch._searchInputXPath);
                search.accept(this, wanted);
                IArcliteWebElement confirm = new ArcliteButton("", arcliteSearch._searchButtonXpath);
                confirm.accept(this, new InputVal());
            }
        }
        /*
         * visit canvas in workflow builder and createds one step, and opens it
         */

        void IActionsVisitor.visitCanvas(ArcliteCanvas element, InputVal wanted)
        {
            int baseX = 170;
            int baseY = 130;

            int destX = int.Parse(wanted.valOne);
            int destY = int.Parse(wanted.valTwo);

            IWebElement canvas = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(element.elementXPath)));
            Actions     click  = new Actions(driver);

            element.addStep.accept(this, new InputVal());

            click.MoveToElement(canvas, baseX, baseY).ClickAndHold().Build().Perform();

            click.MoveByOffset(destX, destY).Build().Perform();

            click.Release().Build().Perform();

            click.MoveToElement(canvas, destX + baseX, destY + baseY).DoubleClick().Build().Perform();
        }
示例#25
0
 public WebElement WaitUntilElementExists(By lookupBy, int timeout = 10)
 {
     try
     {
         var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));
         return(wait.Until(ExpectedConditions.ElementExists(lookupBy)));
     }
     catch (NoSuchElementException ex)
     {
         try
         {
             TakeScreenShot();
             // Assert.Fail(lookupBy + " is not visible for " + timeout + " seconds." + " with message :" + ex.Message);
             throw new Exception(lookupBy + " is not visible for " + timeout + " seconds." + " with message :" + ex.Message);
         }
         catch (Exception ex1)
         {
             throw new Exception("Failed to take screenshot: " + ex1.ToString());
         }
     }
 }
        /*
         * Switches to the main frame of Arclite, usually need to call this after clicking on a navigation tab button and want to access the content inside the tab
         */

        void IActionsVisitor.switchFrame()
        {
            wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt("mainFrame"));
        }
示例#27
0
 internal void ClickMyProfileIcon()
 {
     InitiateWaitVariable();
     Driver.FindElement(By.XPath("//*[@type='accountUnfilled']")).Click();
     wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//a[@data-testid='signin-link']"))).Click();
 }
示例#28
0
 internal void ClickWomenLink()
 {
     InitiateWaitVariable();
     wait.Until(ExpectedConditions.ElementIsVisible(By.Id("women-floor"))).Click();
 }
示例#29
0
        internal IWebElement waitForElementIsPresent(By lookupBy, int maxWaitTime = 60)
        {
            IWebElement element = null;

            try
            {
                element = new WebDriverWait(driver, TimeSpan.FromSeconds(maxWaitTime)).Until(ExpectedConditions.ElementExists(lookupBy));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            if (element != null)
            {
                try
                {
                    string             script     = String.Format(@"arguments[0].style.cssText = ""border-width: 4px; border-style: solid; border-color: {0}"";", "orange");
                    JavascriptExecutor jsExecutor = (JavascriptExecutor)driver;
                    jsExecutor.ExecuteScript(script, new object[] { element });
                    jsExecutor.ExecuteScript(String.Format(@"$(arguments[0].scrollIntoView(true));"), new object[] { element });
                }
                catch { }
            }
            return(element);
        }
示例#30
0
 public void ThenIShouldSeeTextOnPage(string p0)
 {
     new WebDriverWait(sel.Driver, TimeSpan.FromSeconds(3000)).Until(ExpectedConditions.TextToBePresentInElement(sel.Driver.FindElement(By.TagName("body")), p0));
 }