public void CopyIndicators()
        {
            var driver = Driver;
            new NavigateTo(driver).ProfilesAndIndicatorsPage();
            new WaitFor(driver).PageWithModalPopUpToLoad();

            // Select option in menu
            var profileSelect = driver.FindElement(By.Id("selectedProfile"));
            var selectElement = new SelectElement(profileSelect);
            selectElement.SelectByValue("diabetes");

            // Tick an indicator to copy
            var tickBox = driver.FindElements(By.Name("90690_selected"));
            tickBox.First().Click();

            // Click copy
            var copyButton = driver.FindElement(By.Id("copy-indicators-button"));
            copyButton.Click();
            SeleniumHelper.WaitForExpectedElementToBeVisible(driver, By.Id("copyIndicators"));

            // Check the correct profile is selected in the profile menu
            var copyProfileSelect = driver.FindElement(By.Id("selectedProfileId"));
            var copySelectElement = new SelectElement(copyProfileSelect);
            var selectedText = copySelectElement.SelectedOption.Text;
            Assert.AreEqual("Diabetes", selectedText);
        }
        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();
        }
Example #3
0
        public void GivenIHaveEnteredSomethingIntoTheSearch(int zip, int category, int subCategory)
        {
            //Navigate to the site
            driver.Navigate().GoToUrl(WeNeedUHaveUrls.Home);
            // Find the text input element by its name
            IWebElement query = driver.FindElement(By.Name("ZipCode"));
            // Enter something to search for
            query.SendKeys(zip.ToString());
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3000));
            wait.Until(x =>
            {
                try
                {
                    SelectElement selectElement = new SelectElement(driver.AjaxFind(By.Id("Category"), 3000));
                    return selectElement.Options.Count>1;
                }
                catch (StaleElementReferenceException)
                {
                    return false;
                }
            });
            IWebElement dropDownListBox = driver.FindElement(By.Id("Category"));
            
            SelectElement clickThis = new SelectElement(dropDownListBox);
            clickThis.SelectByIndex(category);

            IWebElement dropDownListBox2 = driver.FindElement(By.Id("SubCategory"));
            SelectElement clickThis2 = new SelectElement(dropDownListBox2);
            clickThis2.SelectByIndex(subCategory);

            // Now submit the form
            query.Submit();
        }
        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();
        }
Example #5
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);
        }
Example #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"));
            }
        }
Example #7
0
        //List<string> DajListe(string xpath) {
        //    IWebElement elem = PobierzElement(xpath);
        //    SelectElement selectList = new SelectElement(elem);
        //    IList<IWebElement> options = selectList.Options;
        //    List<string> list = new List<string>();
        //    foreach (IWebElement w in options) {
        //        list.Add(w.Text);
        //    }
        //    return list;
        //}
        public static IList<IWebElement> GetList(IWebElement elem)
        {
            SelectElement selectList = new SelectElement(elem);
            IList<IWebElement> options = selectList.Options;

            return options;
        }
 public static string GetSelectedAreaNameFromMenu(IWebDriver driver)
 {
     var areasDropdown = driver.FindElement(By.Id(FingertipsIds.AreaMenu));
     var selectElements = new SelectElement(areasDropdown);
     var selectArea = selectElements.SelectedOption.Text;
     return selectArea;
 }
Example #9
0
		public void configuration_page_shows_all_settings()
		{
			// Arrange
			LoginAsAdmin();

			// Act
			Driver.FindElement(By.CssSelector("a[href='/settings']")).Click();

			// Assert
			Assert.That(Driver.ElementValue("#SiteName"), Is.EqualTo("Acceptance Tests"));
			Assert.That(Driver.ElementValue("#SiteUrl"), Is.EqualTo(TestConstants.WEB_BASEURL));
			Assert.That(Driver.ElementValue("#ConnectionString"), Is.StringStarting(TestConstants.CONNECTION_STRING));
			Assert.That(Driver.ElementValue("#RecaptchaPrivateKey"), Is.EqualTo("recaptcha-private-key"));
			Assert.That(Driver.ElementValue("#RecaptchaPublicKey"), Is.EqualTo("recaptcha-public-key"));
			Assert.That(Driver.ElementValue("#EditorRoleName"), Is.EqualTo("Editor"));
			Assert.That(Driver.ElementValue("#AdminRoleName"), Is.EqualTo("Admin"));
			Assert.That(Driver.ElementValue("#AttachmentsFolder"), Is.EqualTo(@"~/App_Data/Attachments"));
			Assert.That(Driver.ElementValue("#AllowedFileTypes"), Is.EqualTo("jpg,png,gif,zip,xml,pdf"));

			Assert.False(Driver.IsCheckboxChecked("UseWindowsAuth"));
			Assert.True(Driver.IsCheckboxChecked("AllowUserSignup"));
			Assert.False(Driver.IsCheckboxChecked("IsRecaptchaEnabled"));
			Assert.False(Driver.IsCheckboxChecked("UseObjectCache"));
			Assert.False(Driver.IsCheckboxChecked("UseBrowserCache"));

			Assert.That(Driver.FindElements(By.CssSelector("#DatabaseName option")).Count, Is.EqualTo(4));
			SelectElement element = new SelectElement(Driver.FindElement(By.CssSelector("#DatabaseName")));
			Assert.That(element.SelectedOption.GetAttribute("value"), Is.EqualTo("SqlServer2008"));
			Assert.That(Driver.SelectedIndex("#MarkupType"), Is.EqualTo(0));
			Assert.That(Driver.SelectedIndex("#Theme"), Is.EqualTo(3));
			Assert.False(Driver.IsCheckboxChecked("OverwriteExistingFiles"));
			Assert.That(Driver.ElementValue("#HeadContent"), Is.EqualTo(""));
			Assert.That(Driver.ElementValue("#MenuMarkup"), Is.EqualTo("* %mainpage%\r\n* %categories%\r\n* %allpages%\r\n* %newpage%\r\n* %managefiles%\r\n* %sitesettings%\r\n\r\n"));
		}
        public static string GetSelectedValue(this IWebElement webelement)
        {
            var select = new SelectElement(webelement);
            var selected = select.AllSelectedOptions.First();

            return selected != null ? selected.GetAttribute("value") : string.Empty;
        }
 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();
             }
         }
     }
 }
 public void Selectanoption(IWebDriver driver, By by, string optiontoselect)
 {
     var data = driver.FindElement(@by);
     //IList<IWebElement> dataoptions = data.FindElements(By.TagName("option"));
     var select = new SelectElement(data);
     @select.SelectByText(optiontoselect);
 }
        /// <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();
            }
        }
Example #14
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);
        }
Example #15
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);
        }
		public void SelectByText(string text)
		{
			IWebElement webElement =  _pageElement.WebDriver.WaitForElement(_pageElement.By);

			SelectElement selectElement = new SelectElement(webElement);
			selectElement.SelectByText(text);
		}
Example #17
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);
        }
Example #18
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);
        }
Example #19
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);
        }
Example #20
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);
        }
Example #21
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 + "'");
            }
        }
Example #22
0
        private static void AssetSelection(IWebDriver driver)
        {
            for (var n = 0; n <= 1; n++)
            {
                driver.FindElement(By.CssSelector("img.img-responsive.center-block")).Click();
                driver.FindElement(By.Id("s2id_autogen1")).Click();

                var groups = new SelectElement(driver.FindElement(By.Id("groups")));

                groups.SelectByIndex(n);
                var assetType = groups.SelectedOption.Text;

                driver.FindElement(By.CssSelector("button.btn.gradient")).Click(); //click search

                //Groups dropdown
                IList<IWebElement> details = driver.FindElements(By.LinkText("Details"));

                Console.WriteLine("There are {0} {1} ", details.Count(), assetType);

                NavigateGroups(driver, details);
                // driver.FindElement(By.CssSelector("img.img-responsive.center-block")).Click();

                // driver.FindElement(By.CssSelector("a.select2-search-choice-close")).Click(); //clear
            }
            //Console.ReadKey();
        }
Example #23
0
 public void SelectJobPosition(string job)
 {
     IWebElement jobPosition = driver.FindElement(By.Id("department-select"));
        MakeElementVisible(jobPosition);
        SelectElement selectJobPosition = new SelectElement(jobPosition);
        selectJobPosition.SelectByValue(job);
 }
 public AddFieldDialog Type(FieldType type)
 {
     var element = FindElement("field-type");
     var select = new SelectElement(element);
     select.SelectByValue(type.ToText());
     return this;
 }
Example #25
0
 public void SelectLocation(string location)
 {
     IWebElement jobLocation = driver.FindElement(By.Id("location-select"));
        MakeElementVisible(jobLocation);
        SelectElement selectJobLocation = new SelectElement(jobLocation);
        selectJobLocation.SelectByValue(location);
 }
        public static void OneHundredRecordsOnPage()
        {
            var domainesDropdown = Driver.Instance.FindElement(By.Name("domain-datatables_length"));
            var selectNumberOfDomaines = new SelectElement(domainesDropdown);

            selectNumberOfDomaines.SelectByText("100");
        }
Example #27
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);
        }
        public static IWebElement FindSelectOptionByValue(SelectElement selectElement, string value)
        {
            var option = selectElement.Options
                .FirstOrDefault(x => x.GetAttribute("value") == value);

            return option;
        }
Example #29
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 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 "));
                //}
            }
    }
        public static string getElementValue(this IWebElement pElement, ElementType pElementType)
        {
            string result;
            switch (pElementType)
            {
                case ElementType.TextInput:
                    result = pElement.GetAttribute("value");
                    break;
                case ElementType.Ddl:
                    result = new SelectElement(pElement).SelectedOption.Text;
                    break;
                case ElementType.RadioBtn:
                    result = "";
                    break;
                case ElementType.Btn:
                    result = "";
                    break;
                case ElementType.CheckBox:
                    result = "";
                    break;
                default:
                    result = "";
                    break;
            }

            return result;
        }
Example #32
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 MessageAndAmount SelectCurrency(string currencyCode)
        {
            var currencyCodeSelect = new SelectElement(_currencyCodeDropdown);
            currencyCodeSelect.SelectByText(currencyCode);

            return this;
        }
        public void CheckParkCostandTimeCase1()
        {
            IWebDriver Driver = new ChromeDriver(@"C:\Users\Rebecca\Documents\Visual Studio 2015\Chrome Driver");

            Driver.Navigate().GoToUrl("http://adam.goucher.ca/parkcalc/index.php");
            Thread.Sleep(2000);

            // Select Short-term Parking from Lot drop down menu
            SelectElement Lot = new SelectElement(Driver.FindElement(By.Id("Lot")));
            Lot.SelectByValue("STP");

            // Enter 10:00 PM in Entry Time, select PM in radio button
            Driver.FindElement(By.Id("EntryTime")).Clear();
            Driver.FindElement(By.Id("EntryTime")).SendKeys("10:00");

            Driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[2]/td[2]/font/input[3]")).Click();


            //Enter date as 01/01/2014 In Entry Date
            Driver.FindElement(By.Id("EntryDate")).Clear();
            Driver.FindElement(By.Id("EntryDate")).SendKeys("01/01/2014");

            // Enter 11:00 in Exit Time, select PM in radio button
            Driver.FindElement(By.Id("ExitTime")).Clear();
            Driver.FindElement(By.Id("ExitTime")).SendKeys("11:00");

            Driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[3]/td[2]/font/input[3]")).Click();

            //Enter date as 01/01/2014 In Exit Date
            Driver.FindElement(By.Id("ExitDate")).Clear();
            Driver.FindElement(By.Id("ExitDate")).SendKeys("01/01/2014");

            //Click calculate button, Check cost is equal to $ 2.00, Check duration of stay is (0 Days, 1 Hours, 0 Minutes)
            Driver.FindElement(By.XPath("/html/body/form/input[2]")).Click();
            Thread.Sleep(2000);

            try
            {
                Assert.AreEqual("$ 2.00", Driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[4]/td[2]/span[1]/font/b")).Text);
            }
            catch (Exception ex)
            {
                Driver.Quit();
                Assert.Fail();
            }

            try
            {
                Assert.AreEqual("(0 Days, 1 Hours, 0 Minutes)", Driver.FindElement(By.XPath("/html/body/form/table/tbody/tr[4]/td[2]/span[2]/font/b")).Text.Trim());
            }
            catch (Exception ex)
            {
                Driver.Quit();
                Assert.Fail();
            }

            // Quit Chrome
            Driver.Quit();
        }
 public void GivenIChooseAllFromTheItemsPerPageSelector()
 {
     MKKidsPage kidsPage = (MKKidsPage)ScenarioContext.Current["kidsPage"];
     IWebElement kidsPageItemsSelector = wait.Until(ExpectedConditions.ElementToBeClickable(By.Id(kidsPage.itemsPerPageSelector.GetAttribute("id"))));
     SelectElement itemsPerPageSelector = new SelectElement(kidsPageItemsSelector);
     itemsPerPageSelector.SelectByValue("999999");
     ScenarioContext.Current["kidsPage"] = kidsPage;
 }
 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);
 }
 public WaitWrapper Select()
 {
     Exists().ShouldBeTrue();
     Browser.ScrollElementIntoView(_parentDropDown);
     var select = new SelectElement(_parentDropDown);
     select.SelectByText(Text().GetValue());
     return new WaitWrapper();
 }
Example #38
0
 public int getOptionCountFromDdl(IWebElement webElement)
 {
     activeElement = webElement;
     SelectElement theSelectBox = new SelectElement(activeElement);
     IList<IWebElement> options = theSelectBox.Options;
     System.Diagnostics.Debug.WriteLine("Option Count: " + options.Count);
     return options.Count;
 }
Example #39
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);
        }
 /// <summary>
 /// Select Dropdown using Value
 /// </summary>
 /// <param name="element">IWebElement</param>
 /// <param name="valueToSelect">Value of the element to Select</param>
 /// <return> N/A </return>
 public void SelectDropDownByValue(IWebElement element, string valueToSelect)
 {
     try
     {
         OpenQA.Selenium.Support.UI.SelectElement selectElement = new OpenQA.Selenium.Support.UI.SelectElement(element);
         selectElement.SelectByValue(valueToSelect);
     }
     catch (Exception ex)
     {
         throw new ConduentUIAutomationException(ex.Message);
     }
 }
 /// <summary>
 /// Get all Options displayed in the DropDown
 /// </summary>
 /// <param name="element">IWebElement</param>
 /// <return> List of IWebElement </return>
 public List <string> GetAllOptionsInDropDown(IWebElement element)
 {
     try
     {
         OpenQA.Selenium.Support.UI.SelectElement selectElement = new OpenQA.Selenium.Support.UI.SelectElement(element);
         return(selectElement.Options.Select(x => x.Text).ToList());
     }
     catch (Exception ex)
     {
         throw new ConduentUIAutomationException(ex.Message);
     }
 }
Example #42
0
        public void How_To_Enter_Text_Caps_Lock()
        {
            OpenQA.Selenium.Interactions.Actions action = new OpenQA.Selenium.Interactions.Actions(chromedriver);
            //action.KeyDown(object, "SHIFT");
            action.KeyDown(Keys.Shift);
            action.SendKeys("ab");
            action.Build().Perform();
            string pageTitle = chromedriver.Title;

            //driver.FindElements(By.XPath("")).Count();
            OpenQA.Selenium.Support.UI.SelectElement selectElement = new OpenQA.Selenium.Support.UI.SelectElement(chromedriver.FindElement(By.XPath("")));
            //selectElement.
        }
Example #43
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();
        }
Example #44
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);
        }
Example #45
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);
        }
Example #46
0
        public bool selectByIndex(By locator, int index, string locatorName)
        {
            bool flag = false;

            try
            {
                Select s = new Select(driver.FindElement(locator));
                s.SelectByIndex(index);
                flag = true;
                return(flag);
            }
            catch (Exception)
            {
                return(flag);
            }
        }
Example #47
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);
        }
Example #48
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");
        }
Example #49
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();
        }
Example #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);
        }
Example #51
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();
        }
Example #53
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");
        }
Example #54
0
        public bool selectByValue(By locator, string value, string locatorName)
        {
            bool flag = false;

            try
            {
                Select s = new Select(driver.FindElement(locator));
                s.SelectByValue(value);
                flag = true;
            }
            catch (Exception ex)
            {
                flag = false;
                TakeScreenShot();
                throw new Exception(ex.Message);
            }
            return(flag);
        }
Example #55
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);
        }
Example #56
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);
        }
Example #57
0
        public string GetValue()
        {
            OpenQA.Selenium.Support.UI.SelectElement seIsPrepopulated = new OpenQA.Selenium.Support.UI.SelectElement(WebElement);
            string Value;

            if (seIsPrepopulated.SelectedOption.ToString().Trim() != "")
            {
                Value = seIsPrepopulated.SelectedOption.GetAttribute("value");;
            }
            else
            {
                Value = WebElement.Text;
            }
            if (string.IsNullOrEmpty(Value))
            {
                Value = WebElement.GetAttribute("value");
            }


            return(Value);
        }
Example #58
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);
            }
        }
Example #59
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);
        }
Example #60
0
 /**
  * 下列选择框根据元素属性值(value)选择, 即value = "foo" , 那么这一项将会被选择:
  * &lt;option value="foo"&gt;Bar&lt;/option&gt;
  * @param locator
  * @param value
  * @see    org.openqa.selenium.support.ui.Select.selectByValue(String value)
  */
 public static void SelectByValue(By locator, String value)
 {
     select = new SelectElement(Driver.FindElement(locator));
     select.SelectByValue(value);
 }