private static void DriverTest() { var driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://www.google.com/"); // Find the text input element by its name var query = driver.FindElement(By.Name("q")); // Enter something to search for query.SendKeys("Cheese"); // Now submit the form. WebDriver will find the form for us from the element query.Submit(); // Google's search is rendered dynamically with JavaScript. // Wait for the page to load, timeout after 10 seconds var wait = new WebDriverWait(driver, System.TimeSpan.FromSeconds(10)); wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); }); // Should see: "Cheese - Google Search" System.Console.WriteLine("Page title is: " + driver.Title); //Close the browser driver.Quit(); }
static void Main(string[] args) { FirefoxDriver driver = new FirefoxDriver(); //напрямую в гугл не пробиться - осядем на вводе капчи изза подозрительной деятельности //потому пойдем через яндекс driver.Url = "https://ya.ru"; //ищем гугл driver.FindElementByXPath("//*[@id='text']").SendKeys("Google" + Keys.Enter); //теперь переходим по ссылке от яндекса driver.Url = driver.FindElementByPartialLinkText("google.ru").Text.ToString(); driver.Url = "https://www.google.ru/#newwindow=1&q=zerg+rush"; do { try { driver.FindElementByXPath(".//*[@class='zr_zergling_container']").Click(); } catch { //если зерглинга еще нет } } while (true); //TODO: заменить на число из статистики Console.ReadKey(); driver.Quit(); }
static void Main(string[] args) { // Compile project // Copy "index.html" and "lenna.png" into CSFileUpload.exe directory (bin\Debug\) // Run and enjoy! // создаём объект WebDriver для браузера FireFox var driver = new FirefoxDriver(); // открываем страницу с формой загрузки файла var fileUri = GetUriFromPath(Path.Combine(Environment.CurrentDirectory, "index.html")); driver.Url = fileUri; // находим элемент <input type="file"> var txtFileUpload = driver.FindElement(By.Id("file")); // заполняем элемент путём до загружаемого файла var sourceFile = Path.Combine(Environment.CurrentDirectory, "lenna.png"); txtFileUpload.SendKeys(sourceFile); // находим элемент <input type="submit"> var btnSubmit = driver.FindElement(By.Id("submit")); // нажимаем на элемент (отправляем форму) btnSubmit.Click(); // закрываем браузер driver.Quit(); }
//[Test] public void CanBlockInvalidSslCertificates() { FirefoxProfile profile = new FirefoxProfile(); profile.AcceptUntrustedCertificates = false; string url = EnvironmentManager.Instance.UrlBuilder.WhereIsSecure("simpleTest.html"); IWebDriver secondDriver = null; try { secondDriver = new FirefoxDriver(profile); secondDriver.Url = url; string gotTitle = secondDriver.Title; Assert.AreNotEqual("Hello IWebDriver", gotTitle); } catch (Exception) { Assert.Fail("Creating driver with untrusted certificates set to false failed."); } finally { if (secondDriver != null) { secondDriver.Quit(); } } }
public void SimpleNavigationTest() { // Create a new instance of the Firefox driver. // Notice that the remainder of the code relies on the interface, // not the implementation. // Further note that other drivers (InternetExplorerDriver, // ChromeDriver, etc.) will require further configuration // before this example will work. See the wiki pages for the // individual drivers at http://code.google.com/p/selenium/wiki // for further information. IWebDriver driver = new FirefoxDriver(); //Notice navigation is slightly different than the Java version //This is because 'get' is a keyword in C# driver.Navigate().GoToUrl("http://www.google.com/"); // Find the text input element by its name IWebElement query = driver.FindElement(By.Name("q")); // Enter something to search for query.SendKeys("Cheese"); // Now submit the form. WebDriver will find the form for us from the element query.Submit(); // Google's search is rendered dynamically with JavaScript. // Wait for the page to load, timeout after 10 seconds WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); }); //Close the browser driver.Quit(); }
/// <summary> /// Test form submission on Krossover basketball page /// </summary> public void testBasketballPage(FirefoxDriver driver) { //variables to enter in form string page = "http://www.krossover.com/basketball/"; string name = "Jóhn Dóe"; //international character testing string teamName = "Test Team"; string city = "New York"; string state = "NY"; string sport = "Football"; string gender = "Male"; string email = "*****@*****.**"; string phone = "123-456-789"; string day = "Friday"; //fill out all the fields driver.Navigate().GoToUrl(page); driver.FindElementByName("Field1").SendKeys(name); driver.FindElementByName("Field2").SendKeys(teamName); driver.FindElementByName("Field3").SendKeys(city); driver.FindElementByName("Field4").SendKeys(state); driver.FindElementByName("Field6").FindElement(By.XPath(".//option[contains(text(),'" + sport + "')]")).Click(); driver.FindElementByName("Field7").FindElement(By.XPath(".//option[contains(text(),'" + gender + "')]")).Click(); driver.FindElementByName("Field9").SendKeys(email); driver.FindElementByName("Field11").SendKeys(phone); driver.FindElementByName("Field14").FindElement(By.XPath(".//option[contains(text(),'" + day + "')]")).Click(); driver.FindElementByName("saveForm").Click(); //submit the form /*verify the form submission was actually generated by querying the db * if so, test passes * else, test fails */ driver.Quit(); }
public void Providing_correct_credentials_logs_user_on() { IWebDriver browser = new FirefoxDriver(); browser.Navigate().GoToUrl("http://localhost:3000"); browser.FindElement(By.Id("login_link")).Click(); browser.FindElement(By.Id("username")).SendKeys("testuser"); browser.FindElement(By.Id("password")).SendKeys("abc123"); browser.FindElement(By.Id("login_button")).Click(); WebDriverWait wait = new WebDriverWait(browser, TimeSpan.FromSeconds(10)); IWebElement menuElement = wait.Until<IWebElement>((d) => { return d.FindElement( By.XPath("id('description')")); }); string text = browser.FindElement(By.XPath("id('top-menu')/a[3]")).Text; Assert.AreEqual("Logout", text); Assert.IsTrue( browser.FindElement( By.XPath("id('top-menu')/a[3]")).GetAttribute("href").EndsWith("/logout")); browser.Quit(); }
/// <summary> /// Test all links on the Krossover home page /// </summary> public void testHomePage(FirefoxDriver driver) { string homePage = "http://www.krossover.com/"; driver.Navigate().GoToUrl(homePage); Thread.Sleep(1000); //find all links on the page IList<IWebElement> links = driver.FindElementsByTagName("a"); //loop through all of the links on the page foreach (IWebElement link in links) { try { //check if any of the links return a 404 link.SendKeys(Keys.Control + Keys.Enter); driver.SwitchTo().Window(driver.WindowHandles.Last()); driver.FindElementByXPath("//div[contains(@class, '404')]"); log(link.GetAttribute("href") + " is broken. Returned 404"); driver.SwitchTo().Window(driver.WindowHandles.First()); } catch { //continue to the next link continue; } } driver.Quit(); //kill the driver }
public void FirefoxStartup() { FirefoxDriver dr = new FirefoxDriver(); dr.Manage().Window.Maximize(); dr.Navigate().GoToUrl(url); dr.Quit(); }
public List<FootballItem> Parse() { List<FootballItem> res = new List<FootballItem>(); IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl("https://www.marathonbet.com/su/popular/Football/?menu=true#"); ReadOnlyCollection<IWebElement> main = driver.FindElements(By.ClassName("sport-category-container")); Debug.Assert(main.Count==1); ReadOnlyCollection<IWebElement> containers = main[0].FindElements(By.ClassName("category-container")); foreach (IWebElement container in containers) { ReadOnlyCollection<IWebElement> tables = container.FindElements(By.ClassName("foot-market")); Debug.Assert(tables.Count==1); ReadOnlyCollection<IWebElement> tbodys = tables[0].FindElements(By.XPath(".//tbody[@data-event-name]")); ParseTBody(tbodys, res); } /* WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); }); */ driver.Close(); driver.Quit(); return res; }
static void Main(string[] args) { try { // Instantiating variables string[] theURLs = new string[3]; string[] theCriteria = new string[3]; int wi, milsec=2500; // Instantiating classes IWebDriver wbDriver = new FirefoxDriver(); TheWebURLs webI=new TheWebURLs(); LoggingStuff logMe = new LoggingStuff(); wbDriver.Manage().Window.Maximize(); // Setting values for variables theURLs=webI.getTheURLs(); theCriteria=webI.getSearchCiteria(); string logPath = logMe.createLogName().ToString(); /**********************************************/ // Run Test logMe.writeFile("Selenium Test Log", false, logPath); for(wi = 0; wi < 3; wi++) { // Opens the various web pages Console.WriteLine(theURLs[wi] + ", " + theCriteria[wi]); logMe.writeFile(theURLs[wi] + ", " + theCriteria[wi], true, logPath); wbDriver.Navigate().GoToUrl(theURLs[wi]); Thread.Sleep(milsec*2); } wbDriver.Quit(); } catch (IOException e3) { Console.WriteLine("Failed during Main",e3.Message); } }
public void CreateExamSchemaTest() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://dev.chd.miraclestudios.us/probo-php/admin/apps/backend/site/login"); driver.FindElement(By.Id("UserLoginForm_username")).Clear(); driver.FindElement(By.Id("UserLoginForm_username")).SendKeys("owner"); driver.FindElement(By.Id("UserLoginForm_password")).Clear(); driver.FindElement(By.Id("UserLoginForm_password")).SendKeys("ZFmS!H3*wJ2~^S_zx"); driver.FindElement(By.Id("login-content-button")).Click(); System.Threading.Thread.Sleep(2000); driver.FindElement(By.LinkText("Manage Examination")).Click(); driver.FindElement(By.LinkText("Manage Exam Scheme")).Click(); System.Threading.Thread.Sleep(2000); driver.FindElement(By.LinkText("Create Exam Scheme")).Click(); System.Threading.Thread.Sleep(5000); Random rnd = new Random(); new SelectElement(driver.FindElement(By.Id("PrbExamScheme_exam_category_id"))).SelectByText("Food Safety"); new SelectElement(driver.FindElement(By.Id("levelid"))).SelectByText("Project Manager3610"); driver.FindElement(By.Id("PrbExamScheme_scheme_name")).Clear(); driver.FindElement(By.Id("PrbExamScheme_scheme_name")).SendKeys("ISO softengineering" + rnd.Next(1, 1000)); driver.FindElement(By.Name("yt0")).Click(); string URL = driver.Url; Assert.AreNotEqual("http://dev.chd.miraclestudios.us/probo-php/admin/apps/backend/probo/competencyDomain/view/id/", URL.Substring(0, 89)); driver.Quit(); }
public void Attack1_Protected() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://localhost/LU.ENGI3675.Project04/StudentInput.aspx"); IWebElement query = driver.FindElement(By.Name("fullName")); query.SendKeys("a','2.1'); update students * set gpa = 4.0; --"); query = driver.FindElement(By.Name("GPA")); query.SendKeys("3"); query = driver.FindElement(By.Name("button")); query.Click(); System.Threading.Thread.Sleep(5000); List<LU.ENGI3675.Proj04.App_Code.Students> students = LU.ENGI3675.Proj04.App_Code.DatabaseAccess.Read(); bool allfour = true; foreach (LU.ENGI3675.Proj04.App_Code.Students temp in students) { if (temp.GPA < 4.0) allfour = false; Debug.Write((string)temp.Name); Debug.Write(" "); Debug.WriteLine((double)temp.GPA); } Assert.IsFalse(allfour); //if they aren't all 4.0 gpa, then protected against SQL injection driver.Quit(); }
public void WindowProcess_Demo2() { var articleName = "[小北De编程手记] : Lesson 02 - Selenium For C# 之 核心对象"; _output.WriteLine("Step 01 : 启动浏览器并打开Lesson 01 - Selenium For C#"); IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.cnblogs.com/NorthAlan/p/5155915.html"; _output.WriteLine("Step 02 : 点击链接打开新页面。"); var lnkArticle02 = driver.FindElement(By.LinkText(articleName)); lnkArticle02.Click(); _output.WriteLine("Step 03 : 根据标题获取新页面的句柄。"); var oldWinHandle = driver.CurrentWindowHandle; foreach (var winHandle in driver.WindowHandles) { driver.SwitchTo().Window(winHandle); if (driver.Title.Contains(articleName)) { break; } } _output.WriteLine("Step 04 : 验证新页面标题是否正确。"); var articleTitle = driver.FindElement(By.Id("cb_post_title_url")); Assert.Equal<string>(articleName, articleTitle.Text); _output.WriteLine("Step 05 : 关闭浏览器。"); driver.Quit(); }
public void startBrowser() { FirefoxDriver w = new FirefoxDriver(); // Added Comment w.Url = uploadLocation; w.Manage().Window.Maximize(); Thread.Sleep(5000); w.Quit(); }
public void Kosova() { IWebDriver driver = new FirefoxDriver(); string baseURL; baseURL = "https://www.pecb.com/"; driver.Navigate().GoToUrl(baseURL); driver.Quit(); }
public void TestMensagemAlertaNenhumSelecionado() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl(SITE_URL); driver.FindElement(By.Id("btnSolucionar")).Click(); Assert.IsTrue(driver.FindElement(By.Id("divErrorMessage")).Displayed); driver.Quit(); }
public void CreateBugTest() { IWebDriver driver = new FirefoxDriver(); string baseURL = "http://ifdefined.com/btnet/bugs.aspx"; StringBuilder verificationErrors = new StringBuilder(); driver.Navigate().GoToUrl(baseURL); try { Assert.AreEqual("BugTracker.NET - bugs", driver.Title); } catch (Exception e) { verificationErrors.Append(e.Message); } driver.FindElement(By.XPath("//div[contains(@class, 'align')]/table/tbody/tr/td/a")).Click(); try { Assert.AreEqual("BugTracker.NET - Create Bug", driver.Title); } catch (Exception e) { verificationErrors.Append(e.Message); } try { Assert.AreEqual("Project:", driver.FindElement(By.XPath("//span[conatins(@id, 'project_label')]")).Text); } catch (Exception e) { verificationErrors.Append(e.Message); } // ERROR: Caught exception [ReferenceError: selectLocator is not defined] driver.FindElement(By.CssSelector("option[value=\"3\"]")).Click(); try { Assert.AreEqual("[no project] DemoProject HasCustomFieldsProject HasDifferentPermissionsProject", driver.FindElement(By.Id("project")).Text); } catch (Exception e) { verificationErrors.Append(e.Message); } try { Assert.AreEqual("Project-specific", driver.FindElement(By.Id("label_pcd1")).Text); } catch (Exception e) { verificationErrors.Append(e.Message); } driver.Quit(); }
public void WindowProcess_Demo1() { // 1. 获取窗口定位对象 IWebDriver driver = new FirefoxDriver(); //省略部分代码... ... ITargetLocator locator = driver.SwitchTo(); driver = locator.Window("windowName"); //后续操作... ... driver.Quit(); }
public void MagentoIncorrectUser() { IWebDriver driver = new FirefoxDriver(); string baseURL = "http://demo.nostresscommerce.cz/"; StringBuilder verificationErrors = new StringBuilder(); driver.Navigate().GoToUrl(baseURL); driver.FindElement(By.XPath("//*[contains(@class, 'links')]/li/a")).Click(); driver.FindElement(By.XPath("//input[contains(@id, 'email')]")).Clear(); driver.FindElement(By.XPath("//input[contains(@id, 'email')]")).SendKeys("*****@*****.**"); driver.FindElement(By.XPath("//input[contains(@id, 'pass')]")).Clear(); driver.FindElement(By.XPath("//input[contains(@id, 'pass')]")).SendKeys("123456"); driver.FindElement(By.Id("send2")).Click(); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if ("Login or Create an Account" == driver.FindElement(By.CssSelector("h1")).Text) break; } catch (Exception) { } Thread.Sleep(1000); } try { Assert.AreEqual("Login or Create an Account", driver.FindElement(By.CssSelector("h1")).Text); } catch (Exception e) { verificationErrors.Append(e.Message); } for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if ("Invalid login or password." == driver.FindElement(By.CssSelector("li > span")).Text) break; } catch (Exception) { } Thread.Sleep(1000); } try { Assert.AreEqual("Invalid login or password.", driver.FindElement(By.CssSelector("li > span")).Text); } catch (Exception e) { verificationErrors.Append(e.Message); } driver.Quit(); }
public void SearchTest() { //Navigate to google var driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://google.com"); //type text var searchbox = driver.FindElementById("gbqfq"); searchbox.SendKeys("selenium"); //click search var searchBtn = driver.FindElementById("gbqfb"); searchBtn.Click(); //check results try { var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.ElementExists(By.Id("rso"))); //rso is list of results id var list = driver.FindElementById("rso"); //find selenium website var results = list.FindElements(By.ClassName("vurls")); foreach (var result in results) { if (result.Text == "www.seleniumhq.org/") { //website found Assert.IsTrue(true); driver.Quit(); return; } } //website not found Assert.IsTrue(false); } catch (WebDriverTimeoutException e) { Assert.Fail("No results found"); } //I am lazy to close windows :) driver.Quit(); }
public void Should_display_asterisk_against_missing_user_name() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://localhost:1392/"); driver.FindElement(By.Id("login_LoginButton")).Click(); var missing = driver.FindElement(By.Id("login_UserNameRequired")); Assert.IsTrue(missing.Displayed); driver.Quit(); }
public void ThenIFindThoseItemsOnTheStartPage(int numberOfItems) { var storePage = "http://localhost:8717/"; using (var driver = new FirefoxDriver()) { driver.Navigate().GoToUrl(storePage); var itemsOnPage = driver.FindElementById("itemCount").Text; Assert.AreEqual(numberOfItems.ToString(), itemsOnPage); driver.Quit(); } }
public void GettingStarted() { var driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; driver.Navigate(); Assert.AreEqual("Google", driver.Title); driver.Quit(); }
public void Apply_RedirectToApplyFromSignInPage_ShouldPassTest() { using (IWebDriver wdriver = new FirefoxDriver()) { wdriver.Navigate().GoToUrl("https://softuni.bg"); wdriver.Manage().Window.Maximize(); wdriver.FindElement(By.Id("loginLink")).Click(); Assert.AreEqual(wdriver.Url, "https://softuni.bg/account/authenticate"); wdriver.Quit(); } }
public void HackathonTest() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://testerzy.pl"); driver.FindElement(By.Id("mod-search-searchword")).SendKeys("hackathon dev qa"); driver.FindElement(By.ClassName("button")).Click(); Assert.True(driver.FindElement(By.ClassName("result-title")).Text.Contains("Hackathon")); driver.Quit(); }
public void ShouldBeAbleToStartANamedProfile() { FirefoxProfile profile = new FirefoxProfileManager().GetProfile("default"); if (profile != null) { IWebDriver firefox = new FirefoxDriver(profile); firefox.Quit(); } else { Assert.Ignore("Skipping test: No profile named \"default\" found."); } }
public void ShouldBeAbleToStartMoreThanOneInstanceOfTheFirefoxDriverSimultaneously() { IWebDriver secondDriver = new FirefoxDriver(); driver.Url = xhtmlTestPage; secondDriver.Url = formsPage; Assert.AreEqual("XHTML Test Page", driver.Title); Assert.AreEqual("We Leave From Here", secondDriver.Title); // We only need to quit the second driver if the test passes secondDriver.Quit(); }
static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5)); driver.Url = "http://www.beingzero.in"; // TODO: Write Your Code Here Console.WriteLine("Will be Quitting Browser after 3 Seconds"); Thread.Sleep(3 * 1000); driver.Quit(); }
static void DoIt(string path) { string uri = @"file:///" + path; var d = new FirefoxDriver(); d.Manage().Window.Size = new Size(2000, 2000); d.Navigate().GoToUrl(Path.Combine(uri, "a3.html")); var s = d.GetScreenshot(); s.SaveAsFile(Path.Combine(path, "a3.png"), ImageFormat.Png); d.Quit(); }
static void Main(string[] args) { // test with firefox IWebDriver driver = new OpenQA.Selenium.Firefox.FirefoxDriver(); // test with IE //InternetExplorerOptions options = new InternetExplorerOptions(); //options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; //IWebDriver driver = new OpenQA.Selenium.IE.InternetExplorerDriver(options); SetupTest(); driver.Navigate().GoToUrl(baseURL + "Account/Login.aspx"); IWebElement inputTextUser = driver.FindElement(By.Id("MainContent_LoginUser_UserName")); inputTextUser.Clear(); driver.FindElement(By.Id("MainContent_LoginUser_UserName")).Clear(); driver.FindElement(By.Id("MainContent_LoginUser_UserName")).SendKeys("usuario"); driver.FindElement(By.Id("MainContent_LoginUser_Password")).Clear(); driver.FindElement(By.Id("MainContent_LoginUser_Password")).SendKeys("123"); driver.FindElement(By.Id("MainContent_LoginUser_LoginButton")).Click(); driver.Navigate().GoToUrl(baseURL + "finanzas/consulta.aspx"); // view combo element IWebElement comboBoxSistema = driver.FindElement(By.Id("MainContent_rcbSistema_Arrow")); //Then click when menu option is visible comboBoxSistema.Click(); System.Threading.Thread.Sleep(500); // container of elements systems combo IWebElement listaDesplegableComboSistemas = driver.FindElement(By.Id("MainContent_rcbSistema_DropDown")); listaDesplegableComboSistemas.FindElement(By.XPath("//li[text()='BOMBEO MECANICO']")).Click(); System.Threading.Thread.Sleep(500); IWebElement comboBoxEquipo = driver.FindElement(By.Id("MainContent_rcbEquipo_Arrow")); //Then click when menu option is visible comboBoxEquipo.Click(); System.Threading.Thread.Sleep(500); // container of elements equipment combo IWebElement listaDesplegableComboEquipos = driver.FindElement(By.Id("MainContent_rcbEquipo_DropDown")); listaDesplegableComboEquipos.FindElement(By.XPath("//li[text()='MINI-V']")).Click(); System.Threading.Thread.Sleep(500); driver.FindElement(By.Id("MainContent_Button1")).Click(); try { Assert.AreEqual("BOMBEO MECANICO_22", driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_LabelSistema\"]")).Text); } catch (AssertionException e) { verificationErrors.Append(e.Message); } // verify coin format $1,234,567.89 usd try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelInversionInicial\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelCostoOpMantto\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelCostoEnergia\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelcostoUnitarioEnergia\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } // verify number format 1,234,567.89 try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelConsumo\"]")).Text, "((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})?")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } System.Console.WriteLine("errores: " + verificationErrors); System.Threading.Thread.Sleep(20000); driver.Quit(); }