Exemplo n.º 1
0
 public void ClickOnFavItem(int col, int row, int rowCol)
 {
     // if (!driver.FindElementByCssSelector(cssSelector).Selected)
     SiteDriver.FindElement(String.Format(_demoPage.CheckboxCssSelector, col, row, rowCol), How.CssSelector)
     .Click();
     Console.WriteLine("Clicked on element of Side {0} for row:{1} fav item, selected {2} item", col, row, rowCol);
 }
Exemplo n.º 2
0
 public void PersonalityTest()
 {
     SiteDriver.MaximizeWindow();
     SiteDriver.Open(baseURL);
     Console.WriteLine("Navigate to " + baseURL);
     FillFormFields();
     FillFormFields();
     FillFormFields();
     FillFormFields();
     FillFormFields();
     _demo.ClickOnElementByCssSelector(".submitButton");
     //var checkBoxCount = _demo.FindCountOfElements(".checkboxDiv:nth-of-type(1)>div.form-group");
     //for (int i = 1; i < checkBoxCount+1; i++)
     //{
     //    _demo.ClickOnFavItem( 1, i, 1);
     //    _demo.ClickOnFavItem( 1, i, 2);
     //    _demo.ClickOnFavItem( 1, i, 3);
     //    _demo.ClickOnFavItem( 1, i, 4);
     //}
     //checkBoxCount = _demo.FindCountOfElements(".checkboxDiv:nth-of-type(2)>div.form-group");
     //for (int i = 1; i < checkBoxCount+1; i++)
     //{
     //    _demo.ClickOnFavItem( 2, i, 1);
     //    _demo.ClickOnFavItem( 2, i, 2);
     //    _demo.ClickOnFavItem( 2, i, 3);
     //    _demo.ClickOnFavItem( 2, i, 4);
     //}
 }
Exemplo n.º 3
0
 public void ClickOnElementByCssSelector(string cssSelector)
 {
     // if (!driver.FindElementByCssSelector(cssSelector).Selected)
     SiteDriver.FindElement(cssSelector, How.CssSelector)
     .Click();
     Console.WriteLine("Clicked on element");
 }
Exemplo n.º 4
0
 public void SetValueByCssSelector(string cssSelector, string value)
 {
     SiteDriver.FindElement(cssSelector, How.CssSelector)
     .Clear();
     SiteDriver.FindElement(cssSelector, How.CssSelector)
     .SendKeys(value);
     Console.WriteLine("Set element value as " + value);
 }
Exemplo n.º 5
0
 public void TestInitialize()
 {   //Set the browswer from a build
     SiteDriver.LaunchDriver();
     // DesiredCapabilities capability = new DesiredCapabilities();
     //capability.SetCapability("browserName", "chrome");
     //_driver = new RemoteWebDriver(new Uri("http://192.168.73.67:4445/wd/hub"), capability);
     //_driver = new RemoteWebDriver(new Uri("http://192.168.74.166:4445/wd/hub"), capability);
     //driver = new ChromeDriver();
 }
Exemplo n.º 6
0
        public void SetTextArea(string cssSelector, int length)
        {
            var longtext = new string('a', length);

            SiteDriver.FindElement(cssSelector, How.CssSelector)
            .Clear();
            SiteDriver.FindElement(cssSelector, How.CssSelector)
            .SendKeys(longtext);
            Console.WriteLine("Set text Area with characters of length: " + length);
        }
Exemplo n.º 7
0
        public void ClickFavFood()
        {
            List <IWebElement> listElements = SiteDriver.FindElements(_demoPage.favFood, How.CssSelector);


            foreach (IWebElement e in listElements)
            {
                e.Click();
            }
        }
Exemplo n.º 8
0
        public int SelectMutipleFavFood()
        {
            int count = 0;

            ClickFavFood();
            foreach (IWebElement e in SiteDriver.FindElements(_demoPage.favFood, How.CssSelector))
            {
                count += e.Selected ? 1 : 0;
            }
            Console.WriteLine("count:" + count);
            return(count);
        }
Exemplo n.º 9
0
        public void SelectFavItem()
        {
            List <IWebElement> listElements = SiteDriver.FindElements(_demoPage.fav, How.CssSelector);

            foreach (IWebElement e in listElements)
            {/*
              * if (e.GetAttribute("value").Substring(5, 1) == "1")
              * {*/
                e.Click();
            }
            // }
        }
Exemplo n.º 10
0
        public int SelectMultipleGender()
        {
            List <IWebElement> listElements = SiteDriver.FindElements(_demoPage.gender, How.CssSelector);
            int count = 0;

            foreach (IWebElement e in listElements)
            {
                e.Click();
            }

            foreach (IWebElement e in listElements)
            {
                count += e.Selected ? 1 : 0;
            }
            return(count);
        }
Exemplo n.º 11
0
 public void SetPassword(string strPassword)
 {
     SiteDriver.FindElement(_demoPage.password, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.password, How.CssSelector, strPassword);
 }
Exemplo n.º 12
0
 public int FindCountOfElements(string cssLocator)
 {
     return(SiteDriver.FindElements(cssLocator, How.CssSelector).Count);
 }
Exemplo n.º 13
0
 public void SetCity(string strCity)
 {
     SiteDriver.FindElement(_demoPage.city, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.city, How.CssSelector, strCity);
 }
Exemplo n.º 14
0
 public string getTextBoxValue(string selector, How how)
 {
     return(SiteDriver.FindElement(selector, how).GetAttribute("value"));
 }
Exemplo n.º 15
0
 public void SetState(string strState)
 {
     SiteDriver.FindElement(_demoPage.state, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.state, How.CssSelector, strState);
 }
Exemplo n.º 16
0
 public void ClickResetButton()
 {
     SiteDriver.Click(_demoPage.resetBtn, How.CssSelector);
 }
Exemplo n.º 17
0
 public void ClickSubmitButton()
 {
     SiteDriver.Click(_demoPage.submitBtn, How.CssSelector);
 }
Exemplo n.º 18
0
 public void SetUserName(string strUName)
 {
     SiteDriver.FindElement(_demoPage.username, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.username, How.CssSelector, strUName);
 }
Exemplo n.º 19
0
 public void TestCleanup()
 {
     SiteDriver.Stop();
 }
Exemplo n.º 20
0
 public void SetFullName(string strFullName)
 {
     SiteDriver.FindElement(_demoPage.fullName, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.fullName, How.CssSelector, strFullName);
 }
Exemplo n.º 21
0
 public void SetZipCode(string strZipCode)
 {
     SiteDriver.FindElement(_demoPage.zipCode, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.zipCode, How.CssSelector, strZipCode);
 }
Exemplo n.º 22
0
 public void SetHobbies(string strHobbies)
 {
     SiteDriver.FindElement(_demoPage.hobbies, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.hobbies, How.CssSelector, strHobbies);
 }
Exemplo n.º 23
0
 public void SetIntroduction(string strIntro)
 {
     SiteDriver.FindElement(_demoPage.introduction, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.introduction, How.CssSelector, strIntro);
 }
Exemplo n.º 24
0
 public void SetContactNo(string strContactNo)
 {
     SiteDriver.FindElement(_demoPage.contactNo, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.contactNo, How.CssSelector, strContactNo);
 }
Exemplo n.º 25
0
        public void SelectGender(int gender = 1)
        {
            List <IWebElement> listElements = SiteDriver.FindElements(_demoPage.gender, How.CssSelector);

            listElements[gender].Click();
        }
Exemplo n.º 26
0
        public void SelectSkills(string skill)
        {
            SelectElement selectElement = new SelectElement(SiteDriver.FindElement(_demoPage.skills, How.CssSelector));

            selectElement.SelectByText(skill);
        }
Exemplo n.º 27
0
 public void SetEmail(string strEmail)
 {
     SiteDriver.FindElement(_demoPage.email, How.CssSelector)
     .Clear();
     SiteDriver.SendKeys(_demoPage.email, How.CssSelector, strEmail);
 }
Exemplo n.º 28
0
        public void SelectCountry(string country)
        {
            SelectElement selectElement = new SelectElement(SiteDriver.FindElement(_demoPage.country, How.CssSelector));

            selectElement.SelectByText(country);
        }