Esempio n. 1
0
        protected override void Execute(IWebDriver driver, IWebElement element, CommandDesc command)
        {
            var selectElement = new SelectElement(element);

            var lowerCommand = command.Parameter.ToLower();
            if (lowerCommand.StartsWith("label="))
            {
                selectElement.SelectByText(command.Parameter.Substring(6));
                return;
            }

            if (lowerCommand.StartsWith("value="))
            {
                selectElement.SelectByValue(command.Parameter.Substring(6));
                return;
            }

            if (lowerCommand.StartsWith("index="))
            {
                selectElement.SelectByIndex(int.Parse(command.Parameter.Substring(6)));
                return;
            }

            selectElement.SelectByText(command.Parameter);
        }
        public void AddProject()
        {
            BaseTest.BaseUrl = BugTrackerPage.HomePageUrl;
            BaseTest.Setup(BaseTest.BaseUrl);

            WebDriverWait wait = new WebDriverWait(BaseTest.BaseDriver, TimeSpan.FromSeconds(5));
            wait.Until((d) => { return d.Title.StartsWith("BugTracker"); });

            BugTrackerPage.AreAllElementShown();

            Assert.AreEqual("BugTracker.NET - bugs", BaseTest.BaseDriver.Title);
            // add new bug
            BugTrackerPage.AddNewBugBtn.Click();

            wait.Until((d) => { return d.Title.StartsWith("BugTracker.NET - Create Bug"); });

            try
            {
                Assert.AreEqual("Project:", BugTrackerPage.ProjectTextLabel.Text);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Assert.IsTrue(BugTrackerPage.ProjectSelect.Displayed);
            var select = new SelectElement(BugTrackerPage.ProjectSelect);
            select.SelectByText("HasCustomFieldsProject");
            //BaseTest.BaseDriver.FindElement(By.XPath("//option[@value='3']")).Click();
            Assert.AreEqual("Project-specific", BugTrackerPage.ProjectSpecificLabel.Text);
            Assert.IsTrue(BugTrackerPage.ProjectSpecificSelect.Displayed);

            BaseTest.TearDown();
        }
        public MessageAndAmount SelectCurrency(string currencyCode)
        {
            var currencyCodeSelect = new SelectElement(_currencyCodeDropdown);
            currencyCodeSelect.SelectByText(currencyCode);

            return this;
        }
Esempio n. 4
0
        public void incluirTipoManifestacao(string descricao)
        {
            selecionarTipoManifestante();

            driver.FindElement(By.Id("btnIncluir")).Click();
            Thread.Sleep(3000);

            driver.FindElement(By.Id("inputDescr")).SendKeys(descricao);


            var comboboxTipoManifestacao      = driver.FindElement(By.Id("dropManifestacao"));
            var selectElementTipoManifestacao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoManifestacao);

            selectElementTipoManifestacao.SelectByText("Sim");


            var comboboxOpniao      = driver.FindElement(By.Id("dropOpiniao"));
            var selectElementOpniao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxOpniao);

            selectElementOpniao.SelectByText("Sim");


            var comboboxStatus      = driver.FindElement(By.Id("dropStatus"));
            var selectElementStatus = new OpenQA.Selenium.Support.UI.SelectElement(comboboxStatus);

            selectElementStatus.SelectByText("Ativo");



            driver.FindElement(By.Id("btnSalvar")).Click();
            Thread.Sleep(1000);
        }
    public void LeagueTable()
    {
        //string team = "Nottm Forest";
            FindSport();
            IWebElement football = _driver.FindElement(By.LinkText("Football"));
            football.Click();
            IWebElement tables = _driver.FindElement(By.LinkText("Tables"));
            tables.Click();
            SelectElement dropdown = new SelectElement(_driver.FindElement(By.Id("uk-group-drop-down")));
            IList<IWebElement> dropdownOptions = dropdown.Options;
            dropdown.SelectByText("Championship");
            IWebElement updateTable = _driver.FindElement(By.Id("filter-nav-submit"));
            updateTable.Click();
            IWebElement userTeam = _driver.FindElement(By.Name("Nottm Forest"));
            userTeam.Click();

            foreach (IWebElement dropDownOption in dropdownOptions)
            {
                List<string> optionsText = new List<string>();
                Console.WriteLine(dropDownOption.Text);
                optionsText.Add(dropDownOption.Text);
                //if (dropDownOption.Text == " Championship ")
                //{
                //    Assert.AreEqual(dropDownOption.Text, (" Championship "));
                //}
            }
    }
Esempio n. 6
0
        public void Yeah()
        {
            using (var page = OpenPage(@"http://www.hemnet.se/"))
            {
                page.FindElement(By.Id("search_item_types_tomt")).Click();
                page.FindElement(By.Id("search_item_types_villa")).Click();
                page.FindElement(By.Id("search_item_types_fritidshus")).Click();

                // We must do the selection before interacting with the list, otherwise we will get an error
                var countyList = page.FindElement(By.Id("search_municipality"));
                var countyLabel = countyList.FindElement(By.XPath("//label[contains(.,'Håbo kommun')]"));
                var countyInput = countyLabel.FindElement(By.TagName("input"));

                countyList.Click(); // We must make the "option" visible before clicking on it, otherwise it will fail
                countyInput.Click(); // Selecting the option

                page.FindElementById("search_submit").Submit();

                var sortByList = new SelectElement(page.FindElement(By.Id("search-results-sort-by")));
                sortByList.SelectByText("Inkommet");

                var sortOrderList = new SelectElement(page.FindElement(By.Id("search-results-sort-order")));
                sortOrderList.SelectByText("Nyast först");

                Assert.That("yeah", Is.EqualTo("yeah"));
            }
        }
Esempio n. 7
0
        public void incluirItemTipoManifestacao(string nome, string sigla)
        {
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            selecionarTipoManifestante();

            driver.FindElement(By.XPath("//*[@id='tableTipoManifestacao']/thead/tr/th[1]")).Click();
            Thread.Sleep(3000);
            driver.FindElement(By.Id("btnGridItens")).Click();
            Thread.Sleep(1000);

            driver.FindElement(By.Id("btnIncluir")).Click();

            driver.FindElement(By.Id("inputNome")).SendKeys(nome);

            var comboboxStatus      = driver.FindElement(By.Id("dropStatus"));
            var selectElementStatus = new OpenQA.Selenium.Support.UI.SelectElement(comboboxStatus);

            selectElementStatus.SelectByText("Ativo");

            driver.FindElement(By.Id("inputSigla")).SendKeys(sigla);



            driver.FindElement(By.Id("btnSalvar")).Click();
            Thread.Sleep(1000);
        }
		public void SelectByText(string text)
		{
			IWebElement webElement =  _pageElement.WebDriver.WaitForElement(_pageElement.By);

			SelectElement selectElement = new SelectElement(webElement);
			selectElement.SelectByText(text);
		}
Esempio n. 9
0
        public void sigiloSim()
        {
            var comboboxSigilo      = driver.FindElement(By.Id("dropIndSigilo"));
            var selectElementSigilo = new OpenQA.Selenium.Support.UI.SelectElement(comboboxSigilo);

            selectElementSigilo.SelectByText("Sim");
        }
 public void FillInControlsAsFollows(Table table)
 {
     foreach (var row in table.Rows)
     {
         var element = BrowserDriver.FindElement(By.Name(row[0]));
         var elementType = element.GetAttribute("type");
         if (elementType == "text" || elementType == "password")
         {
             element.Clear();
             element.SendKeys(row[1]);
         }
         if (elementType == "select-one")
         {
             var selectElement = new SelectElement(element);
             selectElement.SelectByText(row[1]);
         }
         if (elementType == "checkbox")
         {
             var needToBeChecked = Convert.ToBoolean(row[1]);
             if ((element.Selected && !needToBeChecked) || (!element.Selected && needToBeChecked))
             {
                 element.Click();
             }
         }
     }
 }
Esempio n. 11
0
        public void incluirDadosManifestacao(string numeroProcesso, string numeroOAB, string nomeAdv, string faleConosco)
        {
            var comboboxTipoProcesso      = driver.FindElement(By.Id("dropTipProc"));
            var selectElementTipoProcesso = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoProcesso);

            selectElementTipoProcesso.SelectByText("Judicial 1ª instância");


            // driver.FindElement(By.Id("inputNumProc")).SendKeys(numeroProcesso);


            //var comboboxManifestante = driver.FindElement(By.Id("dropManifestante"));
            //var selectElementManifestante = new OpenQA.Selenium.Support.UI.SelectElement(comboboxManifestante);
            //selectElementManifestante.SelectByValue("Ativo");

            //var comboboxUC = driver.FindElement(By.Id("dropUC"));
            //var selectElementUC = new OpenQA.Selenium.Support.UI.SelectElement(comboboxUC);
            //selectElementUC.SelectByText("RJ - Rio de Janeiro");

            // driver.FindElement(By.Id("inputNumAdv")).SendKeys(numeroOAB);
            // driver.FindElement(By.Id("inputNomeAdv")).SendKeys(nomeAdv);



            Thread.Sleep(1000);
        }
Esempio n. 12
0
        public void imprimirAnalitico(string dataInicio, string dataFim)
        {
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            selecionarMenuEstatistica();



            driver.FindElement(By.Id("inputDataInicio")).SendKeys(dataInicio);
            driver.FindElement(By.Id("inputDataFim")).SendKeys(dataFim);


            driver.FindElement(By.Id("inputDataInicioReclassificacao")).SendKeys(dataInicio);
            driver.FindElement(By.Id("inputDataFimReclassificacao")).SendKeys(dataFim);



            var combobox      = driver.FindElement(By.Id("dropTipoRelatorio"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Analitico");

            driver.FindElement(By.Id("btnImprimir")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 13
0
        public void TestDropdown()
        {
            //Get the Dropdown as a Select using it's name attribute
             		    SelectElement make = new SelectElement(driver.FindElement(By.Name("make")));

             		    //Verify Dropdown does not support multiple selection
             		    Assert.IsFalse(make.IsMultiple);
             		    //Verify Dropdown has four options for selection
            Assert.AreEqual(4, make.Options.Count);

            //We will verify Dropdown has expected values as listed in a array
            ArrayList exp_options = new ArrayList(new String [] {"BMW", "Mercedes", "Audi","Honda"});
            var act_options = new ArrayList();

            //Retrieve the option values from Dropdown using getOptions() method
            foreach(IWebElement option in make.Options)
                 act_options.Add(option.Text);

            //Verify expected options array and actual options array match
            Assert.AreEqual(exp_options.ToArray(),act_options.ToArray());

            //With Select class we can select an option in Dropdown using Visible Text
            make.SelectByText("Honda");
            Assert.AreEqual("Honda", make.SelectedOption.Text);

            //or we can select an option in Dropdown using value attribute
            make.SelectByValue("audi");
            Assert.AreEqual("Audi", make.SelectedOption.Text);

            //or we can select an option in Dropdown using index
            make.SelectByIndex(0);
            Assert.AreEqual("BMW", make.SelectedOption.Text);
        }
Esempio n. 14
0
        /// <summary>
        /// Uses the Webdriver's support classes, with a better selecting method.
        /// </summary>
        public void SelectEdamCheese(string url)
        {
            try
            {
                _driver = Browser.GetFirefoxDriver();

                _driver.Navigate().GoToUrl(url);

                var select = new SelectElement(_driver.FindElement(By.TagName("select")));
                select.DeselectAll();
                select.SelectByText("Edam");
            }
            catch (OpenQA.Selenium.Support.UI.UnexpectedTagNameException ex)
            {
                Console.WriteLine("An exception occured, while selecting the tag: " + ex.Message);
                Debug.WriteLine("An exception occured, while selecting the tag: " + ex.Message);
            }
            catch (System.InvalidOperationException ex)
            {
                Console.WriteLine("An Invalid operations exception occured: " + ex.Message);
                Debug.WriteLine("An Invalid operations exception occured: " + ex.Message);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("An exception occured: " + ex.Message);
                Debug.WriteLine("An exception occured: " + ex.Message);
            }
            finally
            {
                _driver.Quit();
            }
        }
Esempio n. 15
0
        public void TestHtml5CanvasDrawing()
        {
            try
            {
                driver.Navigate().GoToUrl("http://dl.dropbox.com/u/55228056/html5canvasdraw.html");

                //Get the HTML5 Canvas Element
                IWebElement canvas = driver.FindElement(By.Id("imageTemp"));
                //Select the Pencil Tool
                SelectElement drawtool = new SelectElement(driver.FindElement(By.Id("dtool")));
                drawtool.SelectByText("Pencil");

                //Create a Action Chain for Draw a shape on Canvas
                Actions builder = new Actions(driver);
                builder.ClickAndHold(canvas).MoveByOffset(10, 50).
                                             MoveByOffset(50, 10).
                                             MoveByOffset(-10, -50).
                                             MoveByOffset(-50, -10).Release().Perform();

                //Get a screenshot of Canvas element after Drawing and compare it to the base version
                Screenshot ss = ((ITakesScreenshot)driver).GetScreenshot();
                string screenshot = ss.AsBase64EncodedString;
                byte[] screenshotAsByteArray = ss.AsByteArray;
                ss.SaveAsFile(@"c:\tmp\post.png", ImageFormat.Png);
            }
            catch (Exception e)
            {
                Assert.Fail("Test Failed due to exception '" + e.Message + "'");
            }
        }
Esempio n. 16
0
        public void incluirTextoPadrao(string titulo, string sigla, string descricao)
        {
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            selecionarFormaDeContato();

            btnIncluir.Click();
            inputTitulo.SendKeys(titulo);
            inputSigla.SendKeys(sigla);
            inputDescr.SendKeys(descricao);


            Thread.Sleep(2000);
            var comboboxTipoManifestacao      = driver.FindElement(By.Id("dropManif"));
            var selectElementTipoManifestacao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoManifestacao);

            selectElementTipoManifestacao.SelectByText("1 - Duvidas");

            Thread.Sleep(2000);
            var comboboxTipoItemManifestacao      = driver.FindElement(By.Id("dropItemManif"));
            var selectElementTipoItemManifestacao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoItemManifestacao);

            selectElementTipoItemManifestacao.SelectByText("1 - DUVIDAS SOBRE ADVOGADO DATIVO");


            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Ativo");


            btnAlterar.Click();
            driver.FindElement(By.Id("btnAlterar")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 17
0
        public void incluirDadosManifestacao(string tipoManifestacao)
        {
            var comboboxManifestacao      = driver.FindElement(By.Id("dropManifestacao"));
            var selectElementManifestacao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxManifestacao);

            selectElementManifestacao.SelectByText(tipoManifestacao);
        }
        public static void OneHundredRecordsOnPage()
        {
            var domainesDropdown = Driver.Instance.FindElement(By.Name("domain-datatables_length"));
            var selectNumberOfDomaines = new SelectElement(domainesDropdown);

            selectNumberOfDomaines.SelectByText("100");
        }
Esempio n. 19
0
        public void incluirDadosPessoais(string nomeManifestante, string cpfCnpjManifestante, string rgManifestante, string emailManifestante, string telefone1, string telefone2, string cepManifestante
                                         , string numeroEnderecoManifestante, string complementoEndereco, string bairroEndereco)
        {
            var comboboxCanalAcesso      = driver.FindElement(By.Id("dropCanalAcesso"));
            var selectElementCanalAcesso = new OpenQA.Selenium.Support.UI.SelectElement(comboboxCanalAcesso);

            selectElementCanalAcesso.SelectByText("Formulario Eletronico");


            var comboboxTipoDocumento      = driver.FindElement(By.Id("dropTipoDocumento"));
            var selectElementTipoDocumento = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoDocumento);

            selectElementTipoDocumento.SelectByText("CPF");

            //dados pessoais
            nome.SendKeys(nomeManifestante);
            cpfCNPJ.SendKeys(cpfCnpjManifestante);
            rg.SendKeys(rgManifestante);
            email.SendKeys(emailManifestante);
            tel1.SendKeys(telefone1);
            tel2.SendKeys(telefone2);
            cep.SendKeys(cepManifestante);
            numeroEndereco.SendKeys(numeroEnderecoManifestante);
            complemento.SendKeys(complementoEndereco);
            bairro.SendKeys(bairroEndereco);
            bairro.SendKeys(bairroEndereco);
        }
Esempio n. 20
0
        public void FormTest()
        {
            //initialization: navigate to site, find dropdownlist and selection elements
            driver.Navigate().GoToUrl("http://www.travelocity.com/");
            driver.FindElement(By.Id("primary-header-flight")).Click();
            driver.FindElement(By.Id("flight-type-one-way-label")).Click();
            driver.FindElement(By.Id("flight-origin")).SendKeys("Fuzhou, China (FOC-Changle Intl.)");
            driver.FindElement(By.Id("flight-destination")).SendKeys("Greensboro, NC, United States (GSO-All Airports)");
            driver.FindElement(By.Id("flight-departing")).SendKeys("07/06/2015");
            IWebElement dropdown = driver.FindElement(By.Id("flight-adults"));
            SelectElement select = new SelectElement(dropdown);
            select.SelectByValue("2");
            driver.FindElement(By.Id("advanced-flight-refundable")).Click();
            IWebElement preferred_airline = driver.FindElement(By.Id("flight-advanced-preferred-airline"));
            SelectElement select_airline = new SelectElement(preferred_airline);
            select_airline.SelectByText("Air China");
            driver.FindElement(By.Id("search-button")).Click();

            if(driver.FindElement(By.Id("captchaBox")) !=  null)
            {
                driver.Navigate().Back();
            }

            Thread.Sleep(6000);
            driver.Dispose();
        }
Esempio n. 21
0
 public void ShouldAllowOptionsToBeSelectedByVisibleText()
 {
     IWebElement element = driver.FindElement(By.Name("select_empty_multiple"));
     SelectElement elementWrapper = new SelectElement(element);
     elementWrapper.SelectByText("select_2");
     IWebElement firstSelected = elementWrapper.AllSelectedOptions[0];
     Assert.AreEqual("select_2", firstSelected.Text);
 }
 private void select_option(int listNum, string option)
 {
     var selectionList =
         browser.FindElement(
             By.Id("ctl00_SampleContent_DropDownList" + listNum));
     var optionsList = new SelectElement(selectionList);
     optionsList.SelectByText(option);
 }
 private void select_menu_item(int listNum, string item)
 {
     selectionList =
                     browser.FindElement(
                         By.Id("ctl00_SampleContent_DropDownList" + listNum));
     var optionsList = new SelectElement(selectionList);
     optionsList.SelectByText(item);
 }
Esempio n. 24
0
 public WaitWrapper Select()
 {
     Exists().ShouldBeTrue();
     Browser.ScrollElementIntoView(_parentDropDown);
     var select = new SelectElement(_parentDropDown);
     select.SelectByText(Text().GetValue());
     return new WaitWrapper();
 }
Esempio n. 25
0
 public void IFrame_DropDown_Click()
 {
     this.Browser.Navigate().GoToUrl(@"http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select");
     this.Browser = this.Browser.SwitchTo().Frame("iframeResult");
     this.WaitForElementPresent(By.XPath("/html/body/select"));
     SelectElement selectElement = new SelectElement(this.Browser.FindElement(By.XPath("/html/body/select")));
     selectElement.SelectByText("Saab");
     Assert.AreEqual<string>("Saab", selectElement.SelectedOption.Text);
 }
Esempio n. 26
0
 public void SelectPaidTicketsQuantity(int quantity)
 {
     this.ExecuteStep(() =>
    {
        var paidTicketsQtyDropdown = new SelectElement(Driver.FindElement(By.Id("Items_1__SelectedQuantity")));
        paidTicketsQtyDropdown.SelectByText(quantity.ToString());
        Log.Info(string.Format("Selecting {0} paid ticket(s)", quantity));
    });
 }
Esempio n. 27
0
 public void SelectFreeTicketsQuantity(int quantity)
 {
     this.ExecuteStep(() =>
    {
        var freeTicketsQtyDropdown = new SelectElement(FreeTicketsQtySelector);
        freeTicketsQtyDropdown.SelectByText(quantity.ToString());
        Log.Info(string.Format("Selecting {0} free ticket(s)", quantity));
    });
 }
Esempio n. 28
0
        public void TestMultipleSelectList()
        {
            //Get the List as a Select using it's name attribute
             		    SelectElement color = new SelectElement(driver.FindElement(By.Name("color")));

             		    //Verify List support multiple selection
            Assert.IsTrue(color.IsMultiple);

            //Verify List has five options for selection
            Assert.AreEqual(5, color.Options.Count);

            //Select multiple options in the list using visible text
            color.SelectByText("Black");
            color.SelectByText("Red");
            color.SelectByText("Silver");

            //Verify there 3 options selected in the list
            Assert.AreEqual(3,color.AllSelectedOptions.Count);

            //We will verify list has multiple options selected as listed in a array
            var exp_sel_options = new ArrayList(new String[]{"Black", "Red", "Silver"});
            var act_sel_options = new ArrayList();

            foreach(IWebElement option in color.AllSelectedOptions)
                act_sel_options.Add(option.Text);

            //Verify expected array for selected options match with actual options selected
            Assert.AreEqual(exp_sel_options.ToArray(), act_sel_options.ToArray());

            //Deselect an option using visible text
            color.DeselectByText("Silver");
            //Verify selected options count
            Assert.AreEqual(2, color.AllSelectedOptions.Count);

            //Deselect an option using value attribute of the option
            color.DeselectByValue("rd");
            //Verify selected options count
            Assert.AreEqual(1, color.AllSelectedOptions.Count);

            //Deselect an option using index of the option
            color.DeselectByIndex(0);
            //Verify selected options count
            Assert.AreEqual(0, color.AllSelectedOptions.Count);
        }
Esempio n. 29
0
 public void WhenISelectInto(string Text, string WebElementName)
 {
     if ("Domain Part Select".Equals(WebElementName, StringComparison.InvariantCultureIgnoreCase))
     {
         //new Select(loginScreen.domainPart).selectByVisibleText(text);
         SelectElement selector = new SelectElement(loginPage.domainPart);
         selector.SelectByText(Text);
         //CurrentPage.As<LoginPage>().domainPart.SelectByText(Text);
     }
 }
Esempio n. 30
0
        public void PopulateMenu(string burgerType, string firstName)
        {
            this.AdditionalSugarCheckbox.Click();
            this.AdditionalSugarCheckbox.Click();
            var burgersSelect = new OpenQA.Selenium.Support.UI.SelectElement(this.BurgersSelectElement);

            burgersSelect.SelectByText(burgerType);
            this.FirstNameTextInput.Clear();
            this.FirstNameTextInput.SendKeys(firstName);
        }
Esempio n. 31
0
        public String sortBy(String sortByText)
        {
            IWebElement sortByElement = driver.FindElement( By.Id("sortBy") );
            SelectElement selector = new SelectElement(sortByElement);
            selector.SelectByText(sortByText);

            var selectedItemText = (string)((IJavaScriptExecutor)driver).ExecuteScript("return arguments[0].options[arguments[0].selectedIndex].text;", sortByElement);

            return selectedItemText;
        }
Esempio n. 32
0
 /// <summary>
 /// Select Dropdown using text
 /// </summary>
 /// <param name="element">IWebElement</param>
 /// <param name="textToSelect">Text to Select</param>
 /// <return> N/A </return>
 public void SelectDropDownByText(IWebElement element, string textToSelect)
 {
     try
     {
         OpenQA.Selenium.Support.UI.SelectElement selectElement = new OpenQA.Selenium.Support.UI.SelectElement(element);
         selectElement.SelectByText(textToSelect);
     }
     catch (Exception ex)
     {
         throw new ConduentUIAutomationException(ex.Message);
     }
 }
Esempio n. 33
0
 /// <summary>
 /// Selects some options from a multi-select element
 /// </summary>
 /// <param name="select">the select element</param>
 /// <param name="option">the options to select</param>
 public static void SelectOptions(IWebElement select, IEnumerable<string> options)
 {
     SelectElement sourceSelect = new SelectElement(select);
     if (sourceSelect.IsMultiple)
     {
         sourceSelect.DeselectAll();
     }
     foreach (string option in options)
     {
         sourceSelect.SelectByText(option);
     }
 }
Esempio n. 34
0
 public void Select(Element element, string option)
 {
     var select = new SelectElement((IWebElement)element.Native);
     try
     {
         select.SelectByText(option);
     }
     catch (NoSuchElementException)
     {
         select.SelectByValue(option);
     }
 }
        public void ClickOnSearchBtnInMetaTextGrid(string _conditionalValue, string _valueToSearch)
        {
            var CommandForSearch = TestEnvironment.Driver.FindElement(By.CssSelector(TestEnvironment.LoadXML("ConditionToSearch")));
            var selectelCommandType = new SelectElement(CommandForSearch);
            selectelCommandType.SelectByText(_conditionalValue);

            TestEnvironment.Driver.FindElement(By.CssSelector(TestEnvironment.LoadXML("ValueToBeSearch"))).SendKeys(_valueToSearch);

            System.Threading.Thread.Sleep(3000);

            TestEnvironment.Driver.FindElement(By.CssSelector(TestEnvironment.LoadXML("ClickOnFindButtonInLaunchedGrid1"))).FindElement(By.CssSelector(TestEnvironment.LoadXML("ClickOnFindButtonInLaunchedGrid2"))).Click();

        }
Esempio n. 36
0
        public void RegisterInformation(string userName, string firstName, string lastName, string dateOfBirth, string countryName )
        {
            Driver.FindElement(By.XPath(CreateUserPage.UserNameElement())).SendKeys(userName);
            Driver.FindElement(By.XPath(CreateUserPage.FirstNameElement())).SendKeys(firstName);
            Driver.FindElement(By.XPath(CreateUserPage.LastNameElement())).SendKeys(lastName);
            Driver.FindElement(By.XPath(CreateUserPage.SexMaleElement())).Click();
            Driver.FindElement(By.XPath(CreateUserPage.DobElement())).SendKeys(dateOfBirth);

            //country selection
            SelectElement country = new SelectElement(Driver.FindElement(By.XPath(CreateUserPage.CountryDropDownElement())));
            country.SelectByText(countryName);

            Driver.FindElement(By.XPath(CreateUserPage.AdminCheckBoxElement())).Click();
        }
        public static void SetOrganizationInformation(string primaryorganization, string title, string role)
        {
            var textPrimaryOrganization =
                Driver.FindElement(By.XPath(".//td/label[text()='Primary Organization:']/following::td[2]/input"));
            textPrimaryOrganization.SendKeys(primaryorganization);

            var textTitle = Driver.FindElement(By.XPath(".//td/label[text()='Title:']/following::input[1]"));
            textTitle.SendKeys(title);

            var relationshiptypemultiselectbox =
                Driver.FindElement(By.XPath(".//td/label[text()='Primary Organization Role(s):']/following::td[1]"));
            var relationshiptype = new SelectElement(relationshiptypemultiselectbox);
            relationshiptype.SelectByText(role);
        }
        public ReviewAndDonate SubmitAddress(string country, string address1, string address2, string town, string  postCode)
        {
            var countrySelect = new SelectElement(_countryDropdown);
            countrySelect.SelectByText(country);

            ManualAddressLink.Click();
            AddressLine1TextBox.SendKeys(address1);
            AddressLine2TextBox.SendKeys(address2);
            AddressTownTextBox.SendKeys(town);
            PostCodeTextBox.SendKeys(postCode);
            ContinueButton.Click();

            return Site.Page<ReviewAndDonate>();
        }
Esempio n. 39
0
        public void incluirAndamento()
        {
            btnBuscar.Click();
            btnGridAndamento.Click();

            var comboboxAndamento      = driver.FindElement(By.Id("dropTipoAndamento"));
            var selectElementAndamento = new OpenQA.Selenium.Support.UI.SelectElement(comboboxAndamento);

            selectElementAndamento.SelectByText("Formulario Eletronico");



            btnGridAndamento.Click();
        }
Esempio n. 40
0
        public void alterarAreaManifestacao(string descricao)
        {
            selecionarMenuEstatistica();
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            Thread.Sleep(1000);


            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Ativo");

            driver.FindElement(By.Id("btnSalvar")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 41
0
        public void incluirCanalAcesso(string descricao)
        {
            selecionarMenuCanalAcesso();

            btnIncluir.Click();
            inputDescricao.SendKeys(descricao);

            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Ativo");

            btnSalvar.Click();
            Thread.Sleep(1000);
        }
        public void Run(IWebDriver webDriver, Step step)
        {
            var s = ((SelectOptionStep) step);
            var element = ElementHelper.GetVisibleElement(webDriver, s.Element);

            var selectElement = new SelectElement(element);
            if (!string.IsNullOrEmpty(s.Value))
            {
                selectElement.SelectByValue(s.Value);
            }
            else
            {
                selectElement.SelectByText(s.Text);
            }
        }
Esempio n. 43
0
 public void InputInformation(string elementName, string text)
 {
     var element = WebDriver.FindElement(By.Name(elementName));
     switch (element.TagName)
     {
         case ("select"):
             var selectElement = new SelectElement(element);
             selectElement.SelectByText(text);
             break;
         default:
             try { element.Clear(); } catch { }
             element.SendKeys(text);
             break;
     }
 }
Esempio n. 44
0
        public void incluirDadosPessoais(string nome, string cpfCnpj, string email, string telefone1, string telefone2, string cep, string UF,
                                         string cidade, string endereco, string numeroEndereco, string complemento, string bairro)
        {
            //dados pessoais


            var comboboxManifestacao      = driver.FindElement(By.Id("dropManifacao"));
            var selectElementManifestacao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxManifestacao);

            selectElementManifestacao.SelectByText("1 - Duvidas");


            driver.FindElement(By.Id("inputNome")).SendKeys(nome);

            Thread.Sleep(3000);

            var comboboxCanalAcesso      = driver.FindElement(By.Id("dropCanalAcesso"));
            var selectElementCanalAcesso = new OpenQA.Selenium.Support.UI.SelectElement(comboboxCanalAcesso);

            selectElementCanalAcesso.SelectByText("1 - Formulario Eletronico");


            var comboboxTipoDocumento      = driver.FindElement(By.Id("dropTipoDocumento"));
            var selectElementTipoDocumento = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoDocumento);

            selectElementTipoDocumento.SelectByText("CPF");

            driver.FindElement(By.Id("inputCpfCnpj")).SendKeys(cpfCnpj);

            driver.FindElement(By.Id("inputEmail")).SendKeys(email);

            driver.FindElement(By.Id("inputTelefone_1")).SendKeys(telefone1);
            driver.FindElement(By.Id("inputTelefone_2")).SendKeys(telefone2);
            driver.FindElement(By.Id("inputCEP")).SendKeys(cep);
            driver.FindElement(By.Id("inputUF")).SendKeys(UF);
            driver.FindElement(By.Id("inputCidade")).SendKeys(cidade);
            driver.FindElement(By.Id("inputEndereco")).SendKeys(endereco);
            driver.FindElement(By.Id("inputNumeroEndereco")).SendKeys(numeroEndereco);
            driver.FindElement(By.Id("inputComplemento")).SendKeys(complemento);
            driver.FindElement(By.Id("inputBairro")).SendKeys(bairro);

            var comboboxSigilo      = driver.FindElement(By.Id("dropIndSigilo"));
            var selectElementSigilo = new OpenQA.Selenium.Support.UI.SelectElement(comboboxSigilo);

            selectElementSigilo.SelectByText("Sim");
        }
Esempio n. 45
0
        public void selecionarSistema()
        {
            var combobox      = driver.FindElement(By.Id("cmbSistemas"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("SISTEMA ELETRÔNICO DA OUVIDORIA");

            Thread.Sleep(500);

            var comboboxOrgao      = driver.FindElement(By.Id("cmbOrgaos"));
            var selectElementOrgao = new OpenQA.Selenium.Support.UI.SelectElement(comboboxOrgao);

            selectElementOrgao.SelectByText("OUVID OUVIDORIA GERAL DO PODER JUDICIARIO");


            driver.FindElement(By.Id("cmdEnviar")).Click();
        }
Esempio n. 46
0
        public void consultarRelatorioSintetico()
        {
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            selecionarMenuAreaManifestacao();

            var combobox      = driver.FindElement(By.Id("dropNur"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            Thread.Sleep(1000);
            selectElement.SelectByText("1º NUR");

            driver.FindElement(By.Id("inputNumDias")).SendKeys("1");

            driver.FindElement(By.Id("btnImprimir")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 47
0
        /// <summary>
        /// selectの選択
        /// </summary>
        /// <param name="driver"></param>
        private static void EditSelectField(IWebDriver driver)
        {
            // <select>の選択
            // OpenQA.Selenium.Support.UI(NuGet: Selenium.Supportで入る)の
            // SelectElement()を使って選択する
            var element       = driver.FindElement(By.Id("id_selected"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(element);

            // 選択方法は3種類
            // SelectByIndexは<option>のIndexに一致するもの
            selectElement.SelectByIndex(2);

            // SelectByValueは<option value="1">が一致するもの
            selectElement.SelectByValue("1");

            // SelectByTextは<option>の値が一致するもの
            selectElement.SelectByText("select3");
        }
Esempio n. 48
0
        public void alterarTipoManifestacao(string titulo)
        {
            selecionarTipoManifestante();
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            Thread.Sleep(3000);
            driver.FindElement(By.XPath("//*[@id='tableTipoManifestacao']/thead/tr/th[1]")).Click();
            driver.FindElement(By.Id("btnGridEdit")).Click();


            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Inativo");
            Thread.Sleep(1000);
            driver.FindElement(By.Id("btnAlterar")).Click();

            Thread.Sleep(1000);
        }
        public void incluirAnaliseManifestacao()
        {
            btnGridAnalisar.Click();

            var comboboxAreaManifestacao = driver.FindElement(By.Id("dropAreaManifestacao"));
            var selectElementCanalAcesso = new OpenQA.Selenium.Support.UI.SelectElement(comboboxAreaManifestacao);

            selectElementCanalAcesso.SelectByText("AREA ADMINISTRATIVA");


            var comboboxItemManifestacao   = driver.FindElement(By.Id("dropTipoItemManifestacao"));
            var selectElementTipoDocumento = new OpenQA.Selenium.Support.UI.SelectElement(comboboxItemManifestacao);

            selectElementTipoDocumento.SelectByIndex(1);

            texto.SendKeys("Texto Andamento");
            btnSalvar.Click();
        }
Esempio n. 50
0
        public void incluirFormaDeContato(string descricao)
        {
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            selecionarFormaDeContato();

            driver.FindElement(By.Id("btnIncluir")).Click();

            driver.FindElement(By.Id("inputDescr")).SendKeys(descricao);

            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Ativo");

            driver.FindElement(By.Id("btnSalvar")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 51
0
        public void alterarFormaDeContato(string descricao)
        {
            selecionarFormaDeContato();
            //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            Thread.Sleep(3000);
            driver.FindElement(By.XPath("//*[@id='tableFormaContato']/thead/tr/th[1]")).Click();
            driver.FindElement(By.Id("btnGridEdit")).Click();
            driver.FindElement(By.Id("inputDescr")).Clear();
            driver.FindElement(By.Id("inputDescr")).SendKeys(descricao);

            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Ativo");
            Thread.Sleep(1000);
            driver.FindElement(By.Id("btnAlterar")).Click();

            Thread.Sleep(1000);
        }
Esempio n. 52
0
        public void incluirResposta(string descricao)
        {
            selecionarMenuResposta();



            driver.FindElement(By.Id("btnIncluir")).Click();


            driver.FindElement(By.Id("inputDescrTipoResposta")).SendKeys(descricao);

            var combobox      = driver.FindElement(By.Id("dropStatus"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            selectElement.SelectByText("Ativo");

            driver.FindElement(By.Id("btnSalvar")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 53
0
        public bool selectByVisibleText(By locator, string visibletext, string locatorName)
        {
            bool flag = false;

            try
            {
                /*Highlight element*/

                WebElement         webElement = driver.FindElement(locator);
                JavascriptExecutor js         = driver as JavascriptExecutor;
                js.ExecuteScript("arguments[0].style.border='4px solid yellow'", webElement);
                /*Highlight code ends*/
                Select s = new Select(driver.FindElement(locator));
                s.SelectByText(visibletext);
                flag = true;
                return(flag);
            }
            catch (Exception)
            {
                return(flag);
            }
        }
Esempio n. 54
0
        public void consultarRelatorioAnalitico()
        {
            selecionarMenuAreaManifestacao();

            var combobox      = driver.FindElement(By.Id("dropNur"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(combobox);

            Thread.Sleep(1000);
            selectElement.SelectByText("1º NUR");

            var comboboxTipoRelatorio = driver.FindElement(By.Id("dropTipoRelatorio"));
            var selectElementTipo     = new OpenQA.Selenium.Support.UI.SelectElement(comboboxTipoRelatorio);

            Thread.Sleep(1000);
            selectElementTipo.SelectByText("Analítico");



            driver.FindElement(By.Id("inputNumDias")).SendKeys("1");

            driver.FindElement(By.Id("btnImprimir")).Click();
            Thread.Sleep(1000);
        }
Esempio n. 55
0
 protected void ComboBoxSelectByVisibleText(By locator, string text)
 {
     OpenQA.Selenium.Support.UI.SelectElement comboBox = new OpenQA.Selenium.Support.UI.SelectElement(WaitForElement(locator));
     comboBox.SelectByText(text);
     ExtentReportHelpers.AddTestInfo(3, "PARAMETER: " + text);
 }
Esempio n. 56
0
 /**
  * 下拉选择框根据选项文本值选择, 即当text="Bar", 那么这一项将会被选择:
  * &lt;option value="foo"&gt;Bar&lt;/option&gt;
  * @param locator
  * @param text
  * @see org.openqa.selenium.support.ui.Select.selectByVisibleText(String text)
  */
 public static void SelectByText(By locator, String text)
 {
     select = new SelectElement(Driver.FindElement(locator));
     select.SelectByText(text);
 }
        public void FormsAdminTest()
        {
            // GOOD TEST

            //Login Page + User Management Page
            appURL = "Your Website";
            driver.Navigate().GoToUrl(appURL + "/");
            driver.FindElement(By.Id("HTML Id Assigned to Username Textbox")).SendKeys("username");
            driver.FindElement(By.Id("HTML Id Assigned to Password Textbox")).SendKeys("password");
            driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Login1_LoginButton")).Click();
            driver.FindElement(By.Id("search")).SendKeys("Nisha Verma" + Keys.Enter);
            WebDriverWait impersonateWait = new WebDriverWait(driver, TimeSpan.FromSeconds(40));

            impersonateWait.Until(ExpectedConditions.ElementIsVisible(By.Id("impersonateButton")));
            driver.FindElement(By.Id("impersonateButton")).Click();
            Assert.IsTrue(driver.Title.Contains("User Management"), "Verified title of the page");

            //Admin Page
            //appURL = "Your Website";
            //driver.Navigate().GoToUrl(appURL + "/");
            ////Search Textbox
            //driver.FindElement(By.Id("searchBar")).SendKeys("Admin Page");
            ////System Filter
            //driver.FindElement(By.XPath("//div[@id='sectionSystemFilter']/input")).Click();
            //driver.FindElement(By.XPath("//div[@id='sectionSystemFilter']/input")).SendKeys("Change Control");
            //driver.FindElement(By.XPath("//div[@id='sectionSystemFilter']/input")).SendKeys(Keys.ArrowDown);
            //driver.FindElement(By.XPath("//div[@id='sectionSystemFilter']/input")).SendKeys(Keys.Enter);
            ////Record Type Filter
            //driver.FindElement(By.XPath("//div[@id='sectionRecordTypeFilter']/input")).SendKeys("None");
            ////Save Button
            //driver.FindElement(By.Id("theSaveButton")).Click();
            ////Results
            //Assert.IsTrue(driver.Title.Contains("Forms System Admin"), "Verified title of the page");

            //Forms Record Page
            appURL = "Your Website";
            driver.Navigate().GoToUrl(appURL + "/");
            //System Filter
            driver.FindElement(By.XPath("//div[@id='systemFilter']/input")).Click();
            driver.FindElement(By.XPath("//div[@id='systemFilter']/input")).SendKeys("Maintenance Management");
            driver.FindElement(By.XPath("//div[@id='systemFilter']/input")).SendKeys(Keys.ArrowDown);
            driver.FindElement(By.XPath("//div[@id='systemFilter']/input")).SendKeys(Keys.Enter);
            //Type Filter
            var education     = driver.FindElement(By.Id("recordType"));
            var selectElement = new OpenQA.Selenium.Support.UI.SelectElement(education);

            selectElement.SelectByText("Maintenance Work Request");
            //Search Textbox
            driver.FindElement(By.Id("searchBar")).SendKeys("Records Page");
            //Location Filter
            WebDriverWait locationWait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            locationWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='datum col-sm-1'][1]/div/div/div/div/div/div/div/div/div/div/div/div/input")));
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][1]/div/div/div/div/div/div/div/div/div/div/div/div/input")).SendKeys("Die Design" + Keys.Tab);
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][1]/div/div/div/div/div/div/div/div/div/div/div/div/input")).Click();
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][1]/div/div/div/div/div/div/div/div/div/div/div/div/input")).SendKeys(Keys.Enter);
            //Priority Filter
            WebDriverWait priorityWait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            priorityWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='datum col-sm-1'][2]/div/div/div/input")));
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][2]/div/div/div/input")).SendKeys("3 - Improvement" + Keys.Tab);
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][2]/div/div/div/input")).Click();
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][2]/div/div/div/input")).SendKeys(Keys.Enter);
            //Status Filter
            WebDriverWait statusWait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            statusWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='datum col-sm-1'][3]/div/div/div/input")));
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][3]/div/div/div/input")).SendKeys("Safety issue" + Keys.Tab);
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][3]/div/div/div/input")).Click();
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][3]/div/div/div/input")).SendKeys(Keys.Enter);
            //Problem & Comments Textbox
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][4]/div/textarea")).SendKeys("Problems");
            driver.FindElement(By.XPath("//div[@class='datum col-sm-1'][5]/div/textarea")).SendKeys("Comments");
            //Create Button
            driver.FindElement(By.Id("theSaveButton")).Click();

            Assert.IsTrue(driver.Title.Contains("New Record"), "Verified title of the page");
        }
Esempio n. 58
0
 protected void ComboBoxSelectByVisibleText(By locator, string text)
 {
     OpenQA.Selenium.Support.UI.SelectElement comboBox = new OpenQA.Selenium.Support.UI.SelectElement(WaitForElement(locator));
     comboBox.SelectByText(text);
 }