public void WhenIClickLogOut() { driver.FindElement(By.ClassName("user-profile")).Click(); driver.FindElement(By.LinkText("Logout")).Click(); }
internal IWebElement FindAlertMessage(StatusMessageModel.StatusSeverity severity = StatusMessageModel.StatusSeverity.Success) { var className = $"alert-{StatusMessageModel.ToString(severity)}"; var el = Driver.FindElement(By.ClassName(className)) ?? Driver.WaitForElement(By.ClassName(className)); if (el is null) { throw new NoSuchElementException($"Unable to find {className}"); } return(el); }
public T ClickPSFContinueButton <T>() where T : UiComponent, new() { return(NavigateTo <T>(By.ClassName("filter-home-button"))); }
public void AddCustomPricePlusButton() { var button = GetFormArea().FindElement(By.ClassName(plussButtonClass)); button.Click(); }
//Weight calculation thread private void CalcWeightThread(string _blockInfoPath, string _saveInfoPath, float _assumedWeight = 0.5f, float _percentSim = 50f) { Dictionary <string, string> blockInfo = new Dictionary <string, string>(); string line; int blockTypeCount = 0; int blockCount = 0; ChangeCtrlText(this, string.Format("{0} - Getting project information - Block Types: {1} - Blocks: {2}", ogTitle, blockTypeCount, blockCount)); StreamReader blockInfoFile = new StreamReader(_blockInfoPath); while ((line = blockInfoFile.ReadLine()) != null) { string[] info = line.Split('|'); blockInfo.Add(info[0].Trim(), info[1].Trim()); blockCount += int.Parse(info[1].Trim()); blockTypeCount++; ChangeCtrlText(this, string.Format("{0} - Getting project information - Block Types: {1} - Blocks: {2}", ogTitle, blockTypeCount, blockCount)); } ChangeCtrlText(this, string.Format("{0} - Navigating to \'www.bricklinks.com\'", ogTitle)); ChromeDriver chromeDriver = new ChromeDriver(); chromeDriver.Navigate().GoToUrl("https://www.bricklink.com"); ChangeCtrlText(this, string.Format("{0} - Gathering weight information for project", ogTitle)); int curBlockTypeCount = 0; int curBlockCount = 0; float currentWeight = 0f; Dictionary <string, string> weightInfo = new Dictionary <string, string>(); blockInfoFile.Close(); foreach (KeyValuePair <string, string> block in blockInfo) { try { IWebElement cookiesElem = chromeDriver.FindElement(By.CssSelector("[class='bl-btn primaryBlue text--bold l-margin-right']")); cookiesElem.Click(); }catch { } float blockWeight = 0; ChangeCtrlText(this, string.Format("{0} - Gathering weight information for project - Block Types: {1}/{2} - Blocks: {3}/{4} - Project Weight: {5}g", ogTitle, curBlockTypeCount, blockTypeCount, curBlockCount, blockCount, currentWeight)); chromeDriver.Navigate().GoToUrl(string.Format("https://www.bricklink.com/v2/search.page?q={0}", block.Key)); bool loop = true; while (loop) { IWebElement elem = chromeDriver.FindElement(By.Id("_idSelSortType")); if (elem != null && elem.Displayed && elem.Enabled) { loop = false; } else { IList <IWebElement> elemList = chromeDriver.FindElements(By.ClassName("links")); foreach (IWebElement temp in elemList) { if (temp.Text == "How to Find Items") { if (temp.Displayed && temp.Enabled) { loop = false; } } } } } try { IList <IWebElement> itemListElem = chromeDriver.FindElements(By.ClassName("pspItemNameLink")); int count = 0; string newBlockName = block.Key.ToLower().Replace(" ", ""); int newBlockNameLen = newBlockName.Length; while (count < itemListElem.Count) { try { itemListElem[count].Click(); } catch { count++; } } string tempWeightInfo = chromeDriver.FindElement(By.Id("item-weight-info")).Text; if (!tempWeightInfo.Contains("?")) { blockWeight = float.Parse(tempWeightInfo.Replace("g", "")); } else { blockWeight = _assumedWeight; } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); blockWeight = _assumedWeight; } currentWeight += blockWeight * float.Parse(block.Value); weightInfo.Add(block.Key, blockWeight.ToString() + "g"); curBlockTypeCount++; curBlockCount += int.Parse(block.Value); } ChangeCtrlText(this, string.Format("{0} - Finished calculating weight of project - Block Types: {1}/{2} - Blocks: {3}/{4} - Project Weight: {5}g", ogTitle, curBlockTypeCount, blockTypeCount, curBlockCount, blockCount, currentWeight)); string fileText = ""; foreach (KeyValuePair <string, string> block in weightInfo) { string blockQuantity; blockInfo.TryGetValue(block.Key, out blockQuantity); fileText += string.Format("Block: {0} | Quantity: {1} | Weight(ea): {2} | Weight(total): {3}g\n\n", block.Key, blockQuantity, block.Value, float.Parse(block.Value.Replace("g", "")) * float.Parse(blockQuantity)); } ChangeCtrlText(this, string.Format("{0} - Writing information to \'{1}\' - Block Types: {2}/{3} - Blocks: {4}/{5} - Project Weight: {6}g", ogTitle, _saveInfoPath, curBlockTypeCount, blockTypeCount, curBlockCount, blockCount, currentWeight)); using (StreamWriter writer = new StreamWriter(_saveInfoPath)){ writer.Write(fileText + string.Format("Total Weight: {0}g\nTotal Block Count: {1}", currentWeight, blockCount)); } ChangeCtrlText(this, string.Format("{0} - Finished writing information to \'{1}\' - Block Types: {2}/{3} - Blocks: {4}/{5} - Project Weight: {6}g", ogTitle, _saveInfoPath, curBlockTypeCount, blockTypeCount, curBlockCount, blockCount, currentWeight)); MessageBox.Show(string.Format("Block Types: {0}/{1}\n\nBlocks: {2}/{3}\n\nProject Weight: {4}g", curBlockTypeCount, blockTypeCount, curBlockCount, blockCount, currentWeight), "Finished calculating weight of project"); //Cleanup boi chromeDriver.Close(); foreach (Process proc in Process.GetProcessesByName("chromedriver")) { proc.CloseMainWindow(); } TurnOnInteractables(); }
public BetsResponse Parse(AsianoddsSeleniumDriverManager sdm, ExtendedTime fromDate, TimeZoneKind timeZone) { HandleErrors(sdm); OnInformationSending("Wczytywanie informacji o zakładach..."); sdm.HideElement(By.Id("footer")); var ddlDisciplineType = sdm.FindElementByXPath("//*[@id='selAdvSearchSportType']"); var optionSelectedDiscipline = ddlDisciplineType.FindElements(By.TagName("option")).Single(o => o.Selected); var discipline = optionSelectedDiscipline.Text.ToEnum <DisciplineType>(); var liMenuHistory = sdm.FindElementByXPath("//*[@id='liMenuHistory']"); liMenuHistory.Click(); var txtDateFrom = sdm.FindElementByXPath("//*[@id='txtPlacementDateFrom']"); txtDateFrom.Click(); var divCalendar = sdm.FindElementByXPath("//*[@id='ui-datepicker-div']"); IWebElement aDpPrevBtn() => divCalendar.FindElements(By.TagName("a")).Single(a => a.HasClass("ui-datepicker-prev")); while (!aDpPrevBtn().HasClass("ui-state-disabled")) { aDpPrevBtn().Click(); } var tdDays = divCalendar.FindElements(By.XPath(".//td[@data-handler='selectDay']")); var tdFirstDay = tdDays.MinBy(td => td.FindElement(By.TagName("a")).Text.ToInt()); tdFirstDay.Click(); var btnSearchHistory = sdm.FindElementByXPath("//*[@id='btnSearchHistorySearchPanel']"); btnSearchHistory.TryClickUntilNotCovered(); const string df = "M/d/yyyy"; var newBets = new List <BetResponse>(); IWebElement divHistoricalBets() => sdm.FindElementById("HistoryPageBetsContanier"); IEnumerable <IWebElement> spanDates() => divHistoricalBets().FindElements(By.ClassName("spanDateDay")) .Where(span => span.Text?.Length > 0); sdm.Wait.Until(d => spanDates().Any()); var dates = spanDates().Select(span => span.Text.ToDateTimeExact(df)).Where(d => d.ToExtendedTime() >= fromDate).ToArray(); var unusedDates = dates.ToList(); while (unusedDates.Any()) { OnInformationSending($"Ładowanie zakładów, dzień {dates.Length - unusedDates.Count + 1} z {dates.Length}..."); var currDate = unusedDates.Min(); var spanCurrDate = spanDates().Single(span => span.Text.ToDateTimeExact(df) == currDate); var trCurrStatementItem = spanCurrDate.FindElement(By.XPath(".//ancestor::tr[@class='trStatementItem']")); trCurrStatementItem.Click(); var divDayHistoricalBets = sdm.FindElementById("HistoryPageBetsContanier"); var trBets = divDayHistoricalBets.FindElements(By.ClassName("trSummaryItem")).Where(tr => tr.Displayed).ToArray(); foreach (var trBet in trBets) { var bet = new BetResponse(); var spanTeams = trBet.FindElement(By.ClassName("span_homeName_awayName")); var homeAway = spanTeams.Text.AfterFirst("]").Trim().Split(" -VS- "); var home = homeAway[0].BeforeFirst(" - "); var away = homeAway[1].BeforeFirst(" - "); var spanDate = trBet.FindElement(By.ClassName("spanDate")); var strTime = spanDate.Text.Trim(); var spanLeague = trBet.FindElement(By.ClassName("span_leagueName")); var strLeague = spanLeague.Text.Trim().AfterFirst("*").Split(" ") .Select(w => w.Length > 0 ? w.Take(1).ToUpper() + w.Skip(1).ToLower() : w).JoinAsString(" "); var spanPick = trBet.FindElement(By.ClassName("span_homeaway_hdporgoal")); var strPick = spanPick.Text.Trim(); var spanOdds = trBet.FindElement(By.ClassName("span_odds")); var strOdds = spanOdds.Text.Trim(); var spanStatus = trBet.FindElement(By.ClassName("spanStatus")); var strStatus = spanStatus.Text.Trim(); var spanStake = trBet.FindElement(By.ClassName("spanStake")); var strStake = spanStake.Text.Trim(); var spanScores = trBet.FindElement(By.ClassName("spanScores")); var strMatchResult = spanScores.Text.AfterFirst("FT").Trim(); bet.Date = strTime.ToExtendedTime("MM/dd/yyyy h:mm tt", timeZone); bet.Discipline = discipline; bet.LeagueName = strLeague; bet.MatchHomeName = home; bet.MatchAwayName = away; bet.PickChoice = ParsePickChoice(strPick, home, away); bet.PickValue = strPick.ContainsAll("[", "]") ? strPick.Between("[", "]").ToDoubleN()?.Abs() : null; bet.Odds = strOdds.ToDouble(); bet.BetResult = ParseBetResult(strStatus); bet.Stake = strStake.ToDouble(); bet.HomeScore = strMatchResult.BeforeFirst(":").Trim().ToIntN(); bet.AwayScore = strMatchResult.AfterFirst(":").Trim().ToIntN(); newBets.Add(bet); } var btnBackToStatements = sdm.FindElementByClassName("BackToStatements"); btnBackToStatements.Click(); unusedDates.Remove(currDate); } OnInformationSending("Zakłady zostały pobrane z AsianOdds..."); Bets = newBets; return(this); }
public bool IsLoggedIn() { return(IsElementPresent(By.ClassName("user-info"))); }
public void offer(string url, string number, string firstname, string lastname, string email, string OfferAmount) { By NavigateToProductName = By.XPath("//body/div[@id='wrapper']/div[@id='content']/div[1]/div[4]/div[1]/div[1]/div[1]/div[4]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[7]/div[1]/div[1]/div[1]"); By OfferBTN = By.XPath("//input[@id='button-offer']"); // By OfferModal = By.Id("offerModal"); By MobileNoTXT = By.XPath("//input[@id='phone_with_ddd']"); By FirstNameTXT = By.XPath("//body/div[@id='wrapper']/div[@id='offerModal']/div[1]/div[1]/div[2]/form[1]/div[1]/div[2]/input[1]"); By LastNameTXT = By.XPath("//body/div[@id='wrapper']/div[@id='offerModal']/div[1]/div[1]/div[2]/form[1]/div[1]/div[3]/input[1]"); By EmailTXT = By.XPath("//body/div[@id='wrapper']/div[@id='offerModal']/div[1]/div[1]/div[2]/form[1]/div[1]/div[4]/input[1]"); By OfferTXT = By.XPath("//input[@id='offer']"); By RequestBTN = By.XPath("//button[@id='request']"); By CloseBTN = By.XPath("//button[contains(text(),'Close')]"); By Home = By.XPath("//header/div[3]/div[1]/div[1]/div[2]/div[1]/nav[1]/div[1]/div[2]/div[1]/div[1]/ul[1]/li[1]/a[1]/span[1]/strong[1]"); /* driver.Url = url; * * Thread.Sleep(5000); * * driver.FindElement(By.ClassName("popup-title")).Click(); * driver.FindElement(By.XPath("//button[contains(text(),'×')]")).Click(); * Thread.Sleep(3000);*/ IJavaScriptExecutor js = driver as IJavaScriptExecutor; js.ExecuteScript("window.scrollBy(0,1400);"); // Thread.Sleep(5000); driver.FindElement(NavigateToProductName).Click(); Thread.Sleep(5000); driver.FindElement(OfferBTN).Click(); Thread.Sleep(5000); // driver.FindElement(OfferModal); driver.FindElement(By.ClassName("modal-title")).Click(); // Thread.Sleep(3000); driver.FindElement(MobileNoTXT); if (driver.FindElement(MobileNoTXT).GetAttribute("") == null) { driver.FindElement(MobileNoTXT).SendKeys(number); driver.FindElement(MobileNoTXT).SendKeys(Keys.Tab); } Boolean fnisEnabled = driver.FindElement(FirstNameTXT).Displayed; Boolean lnisEnabled = driver.FindElement(LastNameTXT).Displayed; Boolean emailisEnabled = driver.FindElement(EmailTXT).Displayed; // Thread.Sleep(5000); if (fnisEnabled && lnisEnabled && emailisEnabled) { driver.FindElement(FirstNameTXT).SendKeys(firstname); driver.FindElement(LastNameTXT).SendKeys(lastname); driver.FindElement(EmailTXT).SendKeys(email); } driver.FindElement(OfferTXT).SendKeys(OfferAmount); Thread.Sleep(15000); driver.FindElement(RequestBTN).Click(); Thread.Sleep(9000); driver.FindElement(CloseBTN).Click(); Thread.Sleep(3000); driver.FindElement(Home).Click(); Thread.Sleep(10000); }
internal void ClickNextButton() { Driver.FindElement(By.ClassName("bx-next")).Click(); }
public void addProductsToCart(string myWishlist, WebDriverWait wait) { int[] numOfProducts = { 1, 3, 5 }; int[] basketProducts = { 1, 2, 3 }; int[] products = { 0, 1, 2 }; int counter = 0; float[] prices = new float[0]; float summ = 0; string[] names = new string[0]; for (int i = 0; i < numOfProducts.Length; i++) { _driver.Navigate().GoToUrl(myWishlist); IList <IWebElement> myProduct = _driver.FindElements(By.ClassName("product-name")); myProduct[numOfProducts[i]].Click(); IWebElement addToChartButton = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions. ElementToBeClickable(By.Id("add_to_cart"))); addToChartButton.Click(); IWebElement nameOfProduct = _driver.FindElement(By.TagName("h1")); Array.Resize(ref names, names.Length + 1); names[names.GetUpperBound(0)] = nameOfProduct.Text; IWebElement price = _driver.FindElement(By.Id("our_price_display")); if (price.Text.StartsWith("$")) { Array.Resize(ref prices, prices.Length + 1); // If you have english locale, please delete ".Replace('.', ',')" prices[prices.GetUpperBound(0)] = float.Parse(price.Text.Substring(1).Replace('.', ',')); } IWebElement continueShoppingButton = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions. ElementToBeClickable(By.CssSelector("span.continue"))); continueShoppingButton.Click(); } IWebElement viewShoppingCart = _driver.FindElement(By.CssSelector("a[title='View my shopping cart']")); viewShoppingCart.Click(); for (int i = 0; i < basketProducts.Length; i++) { IList <IWebElement> myProduct = _driver.FindElements(By.CssSelector("p.product-name > a")); if (names[i] == myProduct[basketProducts[i]].Text) { Assert.IsTrue(names[i] == myProduct[basketProducts[i]].Text); Console.WriteLine("addProductsToCart: " + names[i] + " in the cart. Product"); counter++; } } if (counter == 3) { Console.WriteLine("all 3 products are in the cart"); } else { Console.WriteLine("less than 3 products in the cart"); } // Check that products in the detailed page and in the basket are the same, if it is true - count the summ IList <IWebElement> priceOfProduct = _driver.FindElements(By.CssSelector("td.cart_total > span.price")); for (int i = 0; i < products.Length; i++) { if (prices[i] == float.Parse(priceOfProduct[products[i]].Text.Substring(1).Replace('.', ','))) { Assert.IsTrue(prices[i] == float.Parse(priceOfProduct[products[i]].Text.Substring(1).Replace('.', ','))); summ += prices[i]; } else { Console.WriteLine("the price of products are not equal, impossible to calculate the amount"); } } Console.WriteLine("summ of the products of cart: " + summ + " in the cart"); }
public override object Execute(object parameter) { bool canSkipKnightRecruitment = _webDriverBaseMethodsService.ExistsByAndCondition(ExpectedConditions.ElementExists(By.ClassName("knight_recruit_rush")), _timeoutForChceckingElementsExistence); return(canSkipKnightRecruitment); }
public void ICanManipulateCountriesMedals() { IWebDriver driver = new ChromeDriver(@"C:\Users\Kaio Silveira\documents\visual studio 2015\Projects\Olympics\Olympics.Tests\"); driver.Navigate().GoToUrl("http://localhost:55604/"); new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(d => d.FindElement(By.ClassName("btn-add"))); driver.FindElement(By.ClassName("btn-add")).Click(); new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(d => d.FindElement(By.Id("country-name"))); driver.FindElement(By.Id("country-name")).SendKeys("Teste"); driver.FindElement(By.Id("gold-medals")).SendKeys("10"); driver.FindElement(By.Id("silver-medals")).SendKeys("10"); driver.FindElement(By.Id("bronze-medals")).SendKeys("10"); driver.FindElement(By.ClassName("btn-success")).Click(); new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until(d => d.FindElement(By.ClassName("country-box"))); var countryBoxes = driver.FindElements(By.ClassName("country-box")); var countryBox = countryBoxes.Last(); Assert.Equal("Teste", countryBox.FindElement(By.ClassName("country-name")).Text); Assert.Equal("10", countryBox.FindElement(By.ClassName("gold-amount")).Text); Assert.Equal("10", countryBox.FindElement(By.ClassName("silver-amount")).Text); Assert.Equal("10", countryBox.FindElement(By.ClassName("bronze-amount")).Text); countryBox.FindElement(By.ClassName("btn-danger")).Click(); System.Threading.Thread.Sleep(200); Assert.Equal(countryBoxes.Count - 1, driver.FindElements(By.ClassName("country-box")).Count); }
public void TestClickByImageUsingJavaScriptLogo() { IWebElement commvaultLogo = driver.FindElement(By.ClassName("cv-header-logo")); ((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", commvaultLogo); }
public void WhenIClickLogIn() { driver.FindElement(By.ClassName("submit")).Click(); }
public bool IsGroupPresent() { manager.Navigator.GoToGroupsPage(); return(IsElementPresent(By.TagName("span")) && IsElementPresent(By.ClassName("group"))); }
public void TVWeb_001_VerifyBottomBar() { try { log.Info("Verify Bottom Bar Test Started" + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); IWebElement backToTop; IJavaScriptExecutor executor; String myCommunityURL, faceBookURL, twitterURL, linkedinURL, youTubeURL, myCommunityStatus, facebookStatus, twitterStatus, linkedinStatus, youTubeStatus, myIETHeader, IETTvHelp, TvAccType, othIETSites, abtLinksURL, othLinksURL, bottomFooterURL, abtLinkStatus, othLinkStatus, IEThelpURL, IEThelpStatus, IETAccTypeURL, IETAccTypeStatus, bottomLinkStatus, copyRightText; IList <IWebElement> myCommunityLinks, myCommunity, facebook, twitter, linkedin, youTube, footerSection, footerFourSections, abtIET, abtHelp, abtAccType, abtOthSites, bottomFooter, bottomFooterList; String[] arrAbtIET = { "Vision, mission & values", "People", "Our offices & venues", "Savoy Place upgrade", "Working at the IET" }; String[] arrIETHelp = { "FAQ", "Institution", "Technical requirements", "Contact", "Corporate", "Forgot password", "Delegate / Speaker access code" }; String[] arrAccType = { "Institution", "Members", "Visitor", "Corporate", "Individual" }; String[] arrOthSites = { "The IET", "E&T Jobs", "E&T Magazine", "", "IET Connect", "IET Digital Library", "IET Electrical", "IET Faraday", "IET Venues" }; String[] arrBottomFooter = { "Cookies", "Privacy Statement", "Accessibility", "Legal Notices", "T&C" }; int ScrollTop, cntFooterSections, cntGlobal = 0; WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); wait.Until(ExpectedConditions.ElementExists(By.ClassName(or.readingXMLFile("BottomBar", "overLaySpinner", "TVWebPortalOR.xml")))); Thread.Sleep(2000); Boolean resScrollDown = uf.scrollDown(driver); log.Info("Scroll Down Result=" + resScrollDown + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Thread.Sleep(5000); // Verify scroll down is performed Assert.AreEqual(true, resScrollDown); backToTop = driver.FindElement(By.Id(or.readingXMLFile("BottomBar", "backToTop", "TVWebPortalOR.xml"))).FindElement(By.TagName("a")); // Verify Back to Top anchor is present Assert.AreEqual("Click to Go Top", backToTop.GetAttribute("title").ToString()); // Click on Back to Top anchor executor = (IJavaScriptExecutor)driver; executor.ExecuteScript("arguments[0].click();", backToTop); Thread.Sleep(2000); // Verify Back to Top functionality ScrollTop = uf.getScrollTop(driver); Assert.AreEqual(0, ScrollTop); Thread.Sleep(2000); // Once again scroll down for link verification uf.scrollDown(driver); Thread.Sleep(2000); //////// Verify My Community Icon Presence and Status /////// myCommunityLinks = driver.FindElement(By.ClassName(or.readingXMLFile("BottomBar", "myCommunityLinks", "TVWebPortalOR.xml"))).FindElements(By.TagName("li")); log.Info("Total icon List" + myCommunityLinks.Count + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify Total No. of My community icons Assert.AreEqual(5, myCommunityLinks.Count); // Verify MyCommunity section is present myCommunity = myCommunityLinks.ElementAt(0).FindElements(By.TagName("a")); Assert.AreEqual(1, myCommunity.Count); myCommunityURL = myCommunity.ElementAt(0).GetAttribute("href").ToString(); log.Info("My Community URL:" + myCommunityURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify MyCommunity URL Assert.AreEqual("http://mycommunity.theiet.org/?origin=foot-social", myCommunityURL); // Verify MyCommunity Request Status myCommunityStatus = uf.getStatusCode(new Uri(myCommunityURL.ToString())); Assert.AreEqual("OK", myCommunityStatus); // Verify MyCommunity icon title text Assert.AreEqual("My Community icon", myCommunity.ElementAt(0).FindElement(By.TagName("img")).GetAttribute("title").ToString()); // Verify MyCommunity text Assert.AreEqual("MyCommunity", myCommunity.ElementAt(0).FindElement(By.TagName("span")).Text.ToString()); // Verify Facebook icon is present and it's status facebook = myCommunityLinks.ElementAt(1).FindElements(By.TagName("a")); faceBookURL = facebook.ElementAt(0).GetAttribute("href").ToString(); log.Info("Facebook URL:" + faceBookURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify Facebook URL Assert.AreEqual("http://www.theiet.org/policy/media/follow/facebook.cfm?origin=foot-social", faceBookURL); // Verify Facebook Request Status facebookStatus = uf.getStatusCode(new Uri(faceBookURL.ToString())); Assert.AreEqual("OK", facebookStatus); // Verify Facebook icon title text Assert.AreEqual("Facebook icon", facebook.ElementAt(0).FindElement(By.TagName("img")).GetAttribute("title").ToString()); // Verify Twitter icon is present and it's status twitter = myCommunityLinks.ElementAt(2).FindElements(By.TagName("a")); twitterURL = twitter.ElementAt(0).GetAttribute("href").ToString(); log.Info("Twitter URL:" + twitterURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify Twitter URL Assert.AreEqual("http://www.theiet.org/policy/media/follow/twitter.cfm?origin=foot-social", twitterURL); // Verify Twitter Request Status twitterStatus = uf.getStatusCode(new Uri(twitterURL.ToString())); Assert.AreEqual("OK", twitterStatus); // Verify Twitter icon title text Assert.AreEqual("Twitter icon", twitter.ElementAt(0).FindElement(By.TagName("img")).GetAttribute("title").ToString()); // Verify Linkedin icon is present and it's status linkedin = myCommunityLinks.ElementAt(3).FindElements(By.TagName("a")); linkedinURL = linkedin.ElementAt(0).GetAttribute("href").ToString(); log.Info("Linkedin URL:" + linkedinURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify Linkedin URL Assert.AreEqual("http://www.theiet.org/policy/media/follow/linkedin.cfm?origin=foot-social", linkedinURL); // Verify Linkedin Request Status linkedinStatus = uf.getStatusCode(new Uri(linkedinURL.ToString())); Assert.AreEqual("OK", linkedinStatus); // Verify Linkedin icon title text Assert.AreEqual("LinkedIn icon", linkedin.ElementAt(0).FindElement(By.TagName("img")).GetAttribute("title").ToString()); // Verify Youtube icon is present and it's status youTube = myCommunityLinks.ElementAt(4).FindElements(By.TagName("a")); youTubeURL = youTube.ElementAt(0).GetAttribute("href").ToString(); log.Info("YouTube URL:" + youTubeURL); // Verify YouTube URL Assert.AreEqual("http://www.theiet.org/policy/media/follow/youtube.cfm?origin=foot-social", youTubeURL); // Verify YouTube Request Status youTubeStatus = uf.getStatusCode(new Uri(youTubeURL.ToString())); Assert.AreEqual("OK", youTubeStatus); // Verify four sections are present in footer footerSection = driver.FindElements(By.CssSelector(or.readingXMLFile("BottomBar", "footerFourSections", "TVWebPortalOR.xml"))); cntFooterSections = footerSection.Count(); Assert.AreEqual(1, cntFooterSections); footerFourSections = footerSection.ElementAt(0).FindElements(By.TagName("div")); log.Info("Total Footer Sections:" + footerFourSections.Count + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual(4, footerFourSections.Count); // {This needs to be taken from Test Data - Currently it is mentioned in test script} // Verify About the IET section myIETHeader = footerFourSections.ElementAt(0).FindElement(By.TagName("h4")).Text.ToString(); log.Info("My IET Header:" + myIETHeader); // Verify My IET section header text Assert.AreEqual("About the IET", myIETHeader); abtIET = footerFourSections.ElementAt(0).FindElement(By.TagName("ul")).FindElements(By.TagName("li")); // Verify expected no. of links are present under About the IET Assert.AreEqual(5, abtIET.Count()); // Verifying all links present under 'About the IET' section foreach (String val in arrAbtIET) { log.Info("Verifying " + val + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual(abtIET.ElementAt(cntGlobal).FindElement(By.TagName("a")).Text, val); abtLinksURL = abtIET.ElementAt(cntGlobal).FindElement(By.TagName("a")).GetAttribute("href").ToString(); abtLinkStatus = uf.getStatusCode(new Uri(myCommunityURL.ToString())); Assert.AreEqual("OK", abtLinkStatus); cntGlobal++; } // Verify IET.tV help section IETTvHelp = footerFourSections.ElementAt(1).FindElement(By.TagName("h4")).Text.ToString(); log.Info("IET TV Help:" + IETTvHelp); // Verify IET TV. help section header text Assert.AreEqual("IET.tv help", IETTvHelp); cntGlobal = 0; abtHelp = footerFourSections.ElementAt(1).FindElement(By.TagName("ul")).FindElements(By.TagName("li")); // Verify expected no. of links are present under 'IET.tv help' Assert.AreEqual(7, abtHelp.Count()); // Verifying all links present under 'IET.tv help' section foreach (String val in arrIETHelp) { log.Info("Verifying " + val + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual(abtHelp.ElementAt(cntGlobal).FindElement(By.TagName("a")).Text, val); String newVal = val.Replace(" ", "-"); if (cntGlobal == 0) { IEThelpURL = driver.Url.ToString() + "?" + newVal.ToLower(); } else if (cntGlobal == 1 || cntGlobal == 4) { IEThelpURL = driver.Url.ToString() + "?services=h" + newVal.ToLower(); } else { IEThelpURL = driver.Url.ToString() + "?services=" + newVal.ToLower(); } log.Info("IET HELP URL:= " + IEThelpURL); IEThelpStatus = uf.getStatusCode(new Uri(IEThelpURL.ToString())); Assert.AreEqual("OK", IEThelpStatus); cntGlobal++; } // Verify IET.tv account types section TvAccType = footerFourSections.ElementAt(2).FindElement(By.TagName("h4")).Text.ToString(); log.Info("IET TV Account Types:" + TvAccType + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify IET TV. account types header text Assert.AreEqual("IET.tv account types", TvAccType); cntGlobal = 0; abtAccType = footerFourSections.ElementAt(2).FindElement(By.TagName("ul")).FindElements(By.TagName("li")); // Verify expected no. of links are present under 'IET.tv account types' Assert.AreEqual(5, abtAccType.Count()); // Verifying all links present under 'IET.tv help' section foreach (String val in arrAccType) { log.Info("Verifying " + val + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual(abtAccType.ElementAt(cntGlobal).FindElement(By.TagName("a")).Text, val); String newVal = val.Replace(" ", "-"); if (cntGlobal == 0 || cntGlobal == 3) { IETAccTypeURL = driver.Url.ToString() + "?services=a" + newVal.ToLower(); } else { IETAccTypeURL = driver.Url.ToString() + "?services=" + newVal.ToLower(); } log.Info("IET Acc Type URL:= " + IETAccTypeURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); IETAccTypeStatus = uf.getStatusCode(new Uri(IETAccTypeURL.ToString())); Assert.AreEqual("OK", IETAccTypeStatus); cntGlobal++; } // Verify Other IET websites section othIETSites = footerFourSections.ElementAt(3).FindElement(By.TagName("h4")).Text.ToString(); log.Info("Other IET WebSites:" + othIETSites + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify IET TV. help section header text Assert.AreEqual("Other IET websites", othIETSites); cntGlobal = 0; abtOthSites = footerFourSections.ElementAt(3).FindElement(By.TagName("ul")).FindElements(By.TagName("li")); Assert.AreEqual(9, abtOthSites.Count()); // Verifying all links present under 'About the IET' section foreach (String val in arrOthSites) { if (cntGlobal != 3) { log.Info("Verifying " + val + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual(abtOthSites.ElementAt(cntGlobal).FindElement(By.TagName("a")).Text, val); othLinksURL = abtOthSites.ElementAt(cntGlobal).FindElement(By.TagName("a")).GetAttribute("href").ToString(); log.Info("Other IET Websites:= " + othLinksURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); othLinkStatus = uf.getStatusCode(new Uri(othLinksURL.ToString())); Assert.AreEqual("OK", othLinkStatus); } cntGlobal++; } // Verify Bottom Footer - Cookies, Privacy statement etc. cntGlobal = 0; bottomFooter = driver.FindElements(By.CssSelector(or.readingXMLFile("BottomBar", "bottomFooter", "TVWebPortalOR.xml"))); Assert.AreEqual(1, bottomFooter.Count()); // Verify Bottom Footer is present bottomFooterList = bottomFooter.ElementAt(0).FindElement(By.TagName("div")).FindElements(By.TagName("a")); foreach (String val in arrBottomFooter) { log.Info("Verifying " + val + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); // Verify bottom footer value is present as expected Assert.AreEqual(val, bottomFooterList.ElementAt(cntGlobal).Text); bottomFooterURL = bottomFooterList.ElementAt(cntGlobal).GetAttribute("href").ToString(); log.Info("Bottom Footer URL := " + bottomFooterURL + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); bottomLinkStatus = uf.getStatusCode(new Uri(bottomFooterURL.ToString())); Assert.AreEqual("OK", bottomLinkStatus); cntGlobal++; } // Verify Copyright text copyRightText = driver.FindElement(By.CssSelector(or.readingXMLFile("BottomBar", "copyRight", "TVWebPortalOR.xml"))).FindElement(By.TagName("p")).Text.ToString(); log.Info("Copyright text:=" + copyRightText + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual("© 2015 The Institution of Engineering and Technology is registered as a Charity in England & Wales (no 211014) and Scotland (no SC038698)", copyRightText); } catch (Exception e) { log.Error(e.Message + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); Assert.AreEqual(true, false); } }
public void AddBannerEl() { driver.Navigate().GoToUrl(UrlForBanner); driver.Manage().Window.Maximize(); ClickFilesOnRibbon(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(ButtonForNewPage))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ButtonForNewPage))); driver.FindElement(By.XPath(ButtonForNewPage)).Click(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(ButtonSlider))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ButtonSlider))); Thread.Sleep(1000); driver.FindElement(By.XPath(ButtonSlider)).Click(); IWebDriver dialogDriver = driver.SwitchTo().Frame(driver.FindElement(By.ClassName(PopUpMenu))); WebDriverWait dialogWait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); dialogWait.Until(ExpectedConditions.ElementIsVisible(By.XPath(ImgInputFieldClickButt))); dialogWait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ImgInputFieldClickButt))); IWebElement uploadElement = dialogDriver.FindElement(By.Id("ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_InputFile")); uploadElement.SendKeys(@"C:\Users\spsetup\Pictures\plateforme-travail-collaboratif-securise.jpg"); dialogDriver.FindElement(By.Id("ctl00_PlaceHolderMain_ctl03_RptControls_btnOK")).Click();//click ok for upload Thread.Sleep(1000); IWebElement slideElementChoose = driver.FindElement(By.XPath("//*[@id='ctl00_ctl41_g_f280e4d1_4e87_4625_add5_1a09b7d5f83a_ctl00_ctl02_ctl00_ctl01_ctl00_ContentTypeChoice']"));//choose slide slideElementChoose.Click(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='ctl00_ctl41_g_f280e4d1_4e87_4625_add5_1a09b7d5f83a_ctl00_ctl02_ctl00_ctl01_ctl00_ContentTypeChoice']/option[2]")));//choose ete IWebElement nbgSlide = driver.FindElement(By.XPath("//*[@id='ctl00_ctl41_g_f280e4d1_4e87_4625_add5_1a09b7d5f83a_ctl00_ctl02_ctl00_ctl01_ctl00_ContentTypeChoice']/option[2]")); nbgSlide.Click(); IWebElement titleElement = driver.FindElement(By.XPath(TitleInputField)); titleElement.SendKeys("zTestTitle"); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='ShowLearnMore_b09d5dab-b552-4e29-b6cb-a888479b0d80_$BooleanField']"))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id='ShowLearnMore_b09d5dab-b552-4e29-b6cb-a888479b0d80_$BooleanField']"))); IWebElement moreElement = driver.FindElement(By.XPath("//*[@id='ShowLearnMore_b09d5dab-b552-4e29-b6cb-a888479b0d80_$BooleanField']")); moreElement.Click(); IWebElement sliderText = driver.FindElement(By.XPath("//*[@id='SliderTabTitle_e3884de0-9459-4937-baee-751b2af4bdc8_$TextField']")); sliderText.SendKeys("zTestTitle"); IWebElement sliderPlayTime = driver.FindElement(By.XPath("//*[@id='SliderAutoplayDuration_6e202718-aa6e-41c2-8d38-3f0643d2eee7_$NumberField']")); sliderPlayTime.SendKeys("5"); IWebElement pageLookUp = driver.FindElement(By.XPath("//*[@id='PageLookup_b193cfc6-ea26-4a22-a60a-14aabd4c7940_$LookupField']")); pageLookUp.Click(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='PageLookup_b193cfc6-ea26-4a22-a60a-14aabd4c7940_$LookupField']/option[4]"))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id='PageLookup_b193cfc6-ea26-4a22-a60a-14aabd4c7940_$LookupField']/option[4]"))); IWebElement chooseElement = driver.FindElement(By.XPath("//*[@id='PageLookup_b193cfc6-ea26-4a22-a60a-14aabd4c7940_$LookupField']/option[4]")); chooseElement.Click(); IWebElement saveButton = driver.FindElement(By.XPath("//*[@id='ctl00_ctl41_g_f280e4d1_4e87_4625_add5_1a09b7d5f83a_ctl00_ctl02_ctl00_toolBarTbl_RightRptControls_ctl00_ctl00_diidIOSaveItem']")); saveButton.Click(); ChooseItem(); ClickFilesOnRibbon(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(CheckOutButton))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(CheckOutButton))); driver.FindElement(By.XPath(CheckOutButton)).Click(); //Choose Check in Thread.Sleep(2000); IWebDriver dialogDriver2 = driver.SwitchTo().Frame(driver.FindElement(By.ClassName(PopUpMenu))); WebDriverWait dialogWait2 = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); dialogWait2.Until(ExpectedConditions.ElementIsVisible(By.Id(PublishButton))); dialogWait2.Until(ExpectedConditions.ElementToBeClickable(By.Id(PublishButton))); dialogDriver2.FindElement(By.Id(PublishButton)).Click(); //Click Major Version ChooseItem(); ClickFilesOnRibbon(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(ApproveButton))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ApproveButton))); driver.FindElement(By.XPath(ApproveButton)).Click(); //Choose Approve-Reject IWebDriver newDialogDriver = driver.SwitchTo().Frame(driver.FindElement(By.ClassName(PopUpMenu))); WebDriverWait newDialogWait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); newDialogWait.Until(ExpectedConditions.ElementIsVisible(By.Id(ApproveRadioButton))); newDialogWait.Until(ExpectedConditions.ElementToBeClickable(By.Id(ApproveRadioButton))); newDialogDriver.FindElement(By.Id(ApproveRadioButton)).Click(); //Click Approve newDialogWait.Until(ExpectedConditions.ElementToBeClickable(By.Id("ctl00_PlaceHolderMain_ctl00_RptControls_BtnSubmit"))); newDialogDriver.FindElement(By.Id("ctl00_PlaceHolderMain_ctl00_RptControls_BtnSubmit")).Click(); //Click OK driver.SwitchTo().Alert().Accept(); driver.Navigate().GoToUrl(HomeUrlEl); Thread.Sleep(2000); driver.Navigate().GoToUrl(UrlForBanner); ChooseItem(); ClickFilesOnRibbon(); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(DeleteButton))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(DeleteButton))); driver.FindElement(By.XPath(DeleteButton)).Click(); driver.SwitchTo().Alert().Accept(); Thread.Sleep(2000); }
public static void getInfoFromPDP(string item) { ProductDetailPage pdp = new ProductDetailPage(); pdp.Date = DataBase.GetDateFormatDB(); pdp.ProductoId = item; pdp.URL = Driver.Instance.Url; var PDPId = DataBase.AddPDP(pdp); var Date = DataBase.GetDateFormatDB(); ProductDetail2 pd = new ProductDetail2(); pd.DetailTypeId = DataBase.GetDetailTypeId("Title"); pd.Date = Date; pd.ProductDetailPageId = PDPId; pd.Value = Driver.Instance.FindElement(By.ClassName("the-product-title")).Text; DataBase.AddProductDetail(pd); try { IWebElement mainFeatureElement = Driver.Instance.FindElement(By.Id("features")); IList <IWebElement> mainFeatures = mainFeatureElement.FindElements(By.ClassName("show-more-container")); if (mainFeatures.Count == 0) { } else { var iy = 0; foreach (IWebElement mainFeature in mainFeatures) { IWebElement mainFeatureTitle = mainFeature.FindElement(By.TagName("h4")); IWebElement mainFeatureDescription = mainFeature.FindElement(By.ClassName("additional-content")); pd.DetailTypeId = DataBase.GetDetailTypeId("MainFeatureDescription"); pd.Value = mainFeatureDescription.Text; DataBase.AddProductDetail(pd); pd.DetailTypeId = DataBase.GetDetailTypeId("MainFeatureTitle"); pd.Value = mainFeatureTitle.Text; DataBase.AddProductDetail(pd); iy++; } } } catch (NoSuchElementException e) { } try { IWebElement additionalFeatureElement = Driver.Instance.FindElement(By.Id("additionalFeature")); IList <IWebElement> additionalFeatures = additionalFeatureElement.FindElements(By.ClassName("additional-feature")); if (additionalFeatures.Count == 0) { } else { var iy = 0; foreach (IWebElement additionalFeature in additionalFeatures) { IWebElement additionalFeatureTitle = additionalFeature.FindElement(By.TagName("h5")); IWebElement additionalFeatureDescription = additionalFeature.FindElement(By.TagName("p")); pd.DetailTypeId = DataBase.GetDetailTypeId("AdditionalFeatureDescription"); pd.Value = additionalFeatureDescription.Text; DataBase.AddProductDetail(pd); pd.DetailTypeId = DataBase.GetDetailTypeId("AdditionalFeatureTitle"); pd.Value = additionalFeatureTitle.Text; DataBase.AddProductDetail(pd); iy++; } } } catch (NoSuchElementException e) { } try { IList <IWebElement> thumbs = Driver.Instance.FindElements(By.ClassName("s7thumbcell")); foreach (IWebElement imageElement in thumbs) { string a = imageElement.Text; a = a + ""; } } catch (NoSuchElementException e) { } }
/// <summary> /// Gets an instance of the <see cref="By"/> class based on the specified attribute. /// </summary> /// <param name="attribute">The <see cref="FindsByAttribute"/> describing how to find the element.</param> /// <returns>An instance of the <see cref="By"/> class.</returns> public static By From(FindsByAttribute attribute) { var how = attribute.How; var usingValue = attribute.Using; switch (how) { case How.Id: return(By.Id(usingValue)); case How.Name: return(By.Name(usingValue)); case How.TagName: return(By.TagName(usingValue)); case How.ClassName: return(By.ClassName(usingValue)); case How.CssSelector: return(By.CssSelector(usingValue)); case How.LinkText: return(By.LinkText(usingValue)); case How.PartialLinkText: return(By.PartialLinkText(usingValue)); case How.XPath: return(By.XPath(usingValue)); case How.Custom: if (attribute.CustomFinderType == null) { throw new ArgumentException("Cannot use How.Custom without supplying a custom finder type"); } if (!attribute.CustomFinderType.IsSubclassOf(typeof(By))) { throw new ArgumentException("Custom finder type must be a descendent of the By class"); } ConstructorInfo ctor = attribute.CustomFinderType.GetConstructor(new Type[] { typeof(string) }); if (ctor == null) { throw new ArgumentException("Custom finder type must expose a public constructor with a string argument"); } By finder = ctor.Invoke(new object[] { usingValue }) as By; return(finder); } throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Did not know how to construct How from how {0}, using {1}", how, usingValue)); }
public static IWebElement GetHrefNode(IWebElement source) { return(source .FindElement(By.ClassName("feed-pick-title")) .FindElement(By.TagName("a"))); }
public string GetLoggedUserName() { return(driver.FindElement(By.ClassName("user-info")).Text); }
List <SportyBetMatches> GetMatches(IWebElement element) { var bpMatches = new List <SportyBetMatches>(); var matchDivs = element.FindElements(By.XPath(".//div[contains(@class, 'match-table')]/div[contains(@class, 'match-row')]")); foreach (var item in matchDivs) { var selectionAndOdds = new List <SportyBetOdds>(); var teamNames = item.FindElement(By.XPath(".//div[contains(@class, 'left-team-cell')]/div/div[contains(@class, 'teams')]")).GetAttribute("title"); var time = item.FindElement(By.XPath(".//div[contains(@class, 'left-team-cell')]/div/div[contains(@class, 'clock-time')]")).Text.Replace(" ", ""); var _1X2 = item.FindElements(By.XPath(".//div[contains(@class, 'market-cell')]/div[contains(@class, 'm-market')]"))[0]; var _1 = _1X2.FindElements(By.ClassName("m-outcome"))[0]; if (_1.GetAttribute("class").Contains("m-outcome--disabled")) { var _1odd = new SportyBetOdds() { Selection = "1", Value = "0" }; selectionAndOdds.Add(_1odd); } else { var _1odd = new SportyBetOdds() { Selection = "1", Value = _1.FindElement(By.ClassName("m-outcome-odds")).Text }; selectionAndOdds.Add(_1odd); } var _X = _1X2.FindElements(By.ClassName("m-outcome"))[1]; if (_X.GetAttribute("class").Contains("m-outcome--disabled")) { var _Xodd = new SportyBetOdds() { Selection = "X", Value = "0" }; selectionAndOdds.Add(_Xodd); } else { var _Xodd = new SportyBetOdds() { Selection = "X", Value = _X.FindElement(By.ClassName("m-outcome-odds")).Text }; selectionAndOdds.Add(_Xodd); } var _2 = _1X2.FindElements(By.ClassName("m-outcome"))[2]; if (_2.GetAttribute("class").Contains("m-outcome--disabled")) { var _2odd = new SportyBetOdds() { Selection = "2", Value = "0" }; selectionAndOdds.Add(_2odd); } else { var _2odd = new SportyBetOdds() { Selection = "2", Value = _2.FindElement(By.ClassName("m-outcome-odds")).Text }; selectionAndOdds.Add(_2odd); } bpMatches.Add(new SportyBetMatches { TeamNames = teamNames, MatchTime = time, Odds = selectionAndOdds }); } return(bpMatches); }
public async Task CanCreateApiKeys() { //there are 2 ways to create api keys: //as a user through your profile //as an external application requesting an api key from a user using var s = CreateSeleniumTester(); await s.StartAsync(); var tester = s.Server; var user = tester.NewAccount(); await user.GrantAccessAsync(); await user.MakeAdmin(false); s.GoToLogin(); s.LogIn(user.RegisterDetails.Email, user.RegisterDetails.Password); s.GoToProfile(ManageNavPages.APIKeys); s.Driver.FindElement(By.Id("AddApiKey")).Click(); TestLogs.LogInformation("Checking admin permissions"); //not an admin, so this permission should not show Assert.DoesNotContain("btcpay.server.canmodifyserversettings", s.Driver.PageSource); await user.MakeAdmin(); s.Logout(); s.GoToLogin(); s.LogIn(user.RegisterDetails.Email, user.RegisterDetails.Password); s.GoToProfile(ManageNavPages.APIKeys); s.Driver.FindElement(By.Id("AddApiKey")).Click(); Assert.Contains("btcpay.server.canmodifyserversettings", s.Driver.PageSource); //server management should show now s.Driver.SetCheckbox(By.Id("btcpay.server.canmodifyserversettings"), true); s.Driver.SetCheckbox(By.Id("btcpay.store.canmodifystoresettings"), true); s.Driver.SetCheckbox(By.Id("btcpay.user.canviewprofile"), true); s.Driver.FindElement(By.Id("Generate")).Click(); var superApiKey = s.FindAlertMessage().FindElement(By.TagName("code")).Text; TestLogs.LogInformation("Checking super admin key"); //this api key has access to everything await TestApiAgainstAccessToken(superApiKey, tester, user, Policies.CanModifyServerSettings, Policies.CanModifyStoreSettings, Policies.CanViewProfile); s.Driver.FindElement(By.Id("AddApiKey")).Click(); s.Driver.SetCheckbox(By.Id("btcpay.server.canmodifyserversettings"), true); s.Driver.FindElement(By.Id("Generate")).Click(); var serverOnlyApiKey = s.FindAlertMessage().FindElement(By.TagName("code")).Text; TestLogs.LogInformation("Checking CanModifyServerSettings permissions"); await TestApiAgainstAccessToken(serverOnlyApiKey, tester, user, Policies.CanModifyServerSettings); s.Driver.FindElement(By.Id("AddApiKey")).Click(); s.Driver.SetCheckbox(By.Id("btcpay.store.canmodifystoresettings"), true); s.Driver.FindElement(By.Id("Generate")).Click(); var allStoreOnlyApiKey = s.FindAlertMessage().FindElement(By.TagName("code")).Text; TestLogs.LogInformation("Checking CanModifyStoreSettings permissions"); await TestApiAgainstAccessToken(allStoreOnlyApiKey, tester, user, Policies.CanModifyStoreSettings); s.Driver.FindElement(By.Id("AddApiKey")).Click(); s.Driver.FindElement(By.CssSelector("button[value='btcpay.store.canmodifystoresettings:change-store-mode']")).Click(); //there should be a store already by default in the dropdown var src = s.Driver.PageSource; var getPermissionValueIndex = s.Driver.FindElement(By.CssSelector("input[value='btcpay.store.canmodifystoresettings']")) .GetAttribute("name") .Replace(".Permission", ".SpecificStores[0]"); var dropdown = s.Driver.FindElement(By.Name(getPermissionValueIndex)); var option = dropdown.FindElement(By.TagName("option")); var storeId = option.GetAttribute("value"); option.Click(); s.Driver.FindElement(By.Id("Generate")).Click(); var selectiveStoreApiKey = s.FindAlertMessage().FindElement(By.TagName("code")).Text; TestLogs.LogInformation("Checking CanModifyStoreSettings with StoreId permissions"); await TestApiAgainstAccessToken(selectiveStoreApiKey, tester, user, Permission.Create(Policies.CanModifyStoreSettings, storeId).ToString()); s.Driver.FindElement(By.Id("AddApiKey")).Click(); s.Driver.FindElement(By.Id("Generate")).Click(); var noPermissionsApiKey = s.FindAlertMessage().FindElement(By.TagName("code")).Text; TestLogs.LogInformation("Checking no permissions"); await TestApiAgainstAccessToken(noPermissionsApiKey, tester, user); await Assert.ThrowsAnyAsync <HttpRequestException>(async() => { await TestApiAgainstAccessToken <bool>("incorrect key", $"{TestApiPath}/me/id", tester.PayTester.HttpClient); }); TestLogs.LogInformation("Checking authorize screen"); //let's test the authorized screen now //options for authorize are: //applicationName //redirect //permissions //strict //selectiveStores //redirect //appidentifier var appidentifier = "testapp"; var callbackUrl = s.ServerUri + "postredirect-callback-test"; var authUrl = BTCPayServerClient.GenerateAuthorizeUri(s.ServerUri, new[] { Policies.CanModifyStoreSettings, Policies.CanModifyServerSettings }, applicationDetails: (appidentifier, new Uri(callbackUrl))).ToString(); s.Driver.Navigate().GoToUrl(authUrl); Assert.Contains(appidentifier, s.Driver.PageSource); Assert.Equal("hidden", s.Driver.FindElement(By.Id("btcpay.store.canmodifystoresettings")).GetAttribute("type").ToLowerInvariant()); Assert.Equal("true", s.Driver.FindElement(By.Id("btcpay.store.canmodifystoresettings")).GetAttribute("value").ToLowerInvariant()); Assert.Equal("hidden", s.Driver.FindElement(By.Id("btcpay.server.canmodifyserversettings")).GetAttribute("type").ToLowerInvariant()); Assert.Equal("true", s.Driver.FindElement(By.Id("btcpay.server.canmodifyserversettings")).GetAttribute("value").ToLowerInvariant()); Assert.DoesNotContain("change-store-mode", s.Driver.PageSource); s.Driver.FindElement(By.Id("consent-yes")).Click(); Assert.Equal(callbackUrl, s.Driver.Url); var apiKeyRepo = s.Server.PayTester.GetService <APIKeyRepository>(); var accessToken = GetAccessTokenFromCallbackResult(s.Driver); await TestApiAgainstAccessToken(accessToken, tester, user, (await apiKeyRepo.GetKey(accessToken)).GetBlob().Permissions); authUrl = BTCPayServerClient.GenerateAuthorizeUri(s.ServerUri, new[] { Policies.CanModifyStoreSettings, Policies.CanModifyServerSettings }, false, true, applicationDetails: (null, new Uri(callbackUrl))).ToString(); s.Driver.Navigate().GoToUrl(authUrl); Assert.DoesNotContain("kukksappname", s.Driver.PageSource); Assert.Equal("checkbox", s.Driver.FindElement(By.Id("btcpay.store.canmodifystoresettings")).GetAttribute("type").ToLowerInvariant()); Assert.Equal("true", s.Driver.FindElement(By.Id("btcpay.store.canmodifystoresettings")).GetAttribute("value").ToLowerInvariant()); Assert.Equal("checkbox", s.Driver.FindElement(By.Id("btcpay.server.canmodifyserversettings")).GetAttribute("type").ToLowerInvariant()); Assert.Equal("true", s.Driver.FindElement(By.Id("btcpay.server.canmodifyserversettings")).GetAttribute("value").ToLowerInvariant()); s.Driver.SetCheckbox(By.Id("btcpay.server.canmodifyserversettings"), false); Assert.Contains("change-store-mode", s.Driver.PageSource); s.Driver.FindElement(By.Id("consent-yes")).Click(); Assert.Equal(callbackUrl, s.Driver.Url); accessToken = GetAccessTokenFromCallbackResult(s.Driver); TestLogs.LogInformation("Checking authorized permissions"); await TestApiAgainstAccessToken(accessToken, tester, user, (await apiKeyRepo.GetKey(accessToken)).GetBlob().Permissions); //let's test the app identifier system authUrl = BTCPayServerClient.GenerateAuthorizeUri(s.ServerUri, new[] { Policies.CanModifyStoreSettings, Policies.CanModifyServerSettings }, false, true, (appidentifier, new Uri(callbackUrl))).ToString(); //if it's the same, go to the confirm page s.Driver.Navigate().GoToUrl(authUrl); s.Driver.FindElement(By.Id("continue")).Click(); Assert.Equal(callbackUrl, s.Driver.Url); //same app but different redirect = nono authUrl = BTCPayServerClient.GenerateAuthorizeUri(s.ServerUri, new[] { Policies.CanModifyStoreSettings, Policies.CanModifyServerSettings }, false, true, (appidentifier, new Uri("https://international.local/callback"))).ToString(); s.Driver.Navigate().GoToUrl(authUrl); Assert.False(s.Driver.Url.StartsWith("https://international.com/callback")); // Make sure we can check all permissions when not an admin await user.MakeAdmin(false); s.Logout(); s.GoToLogin(); s.LogIn(user.RegisterDetails.Email, user.RegisterDetails.Password); s.GoToProfile(ManageNavPages.APIKeys); s.Driver.FindElement(By.Id("AddApiKey")).Click(); int checkedPermissionCount = 0; foreach (var checkbox in s.Driver.FindElements(By.ClassName("form-check-input"))) { checkedPermissionCount++; checkbox.Click(); } s.Driver.FindElement(By.Id("Generate")).Click(); var allAPIKey = s.FindAlertMessage().FindElement(By.TagName("code")).Text; TestLogs.LogInformation("Checking API key permissions"); var apikeydata = await TestApiAgainstAccessToken <ApiKeyData>(allAPIKey, "api/v1/api-keys/current", tester.PayTester.HttpClient); Assert.Equal(checkedPermissionCount, apikeydata.Permissions.Length); }
private void GetDailyOffer() { Logger.Instance.LogMethodStart(); //always go at least once NavigateToUrl(_browserDriverCurrentSearchUser, "https://www.bing.com/rewards/dashboard", _minWait); try { IReadOnlyCollection <IWebElement> divs = _browserDriverCurrentSearchUser.FindElements(By.ClassName("tile-height")); List <IWebElement> divsToClick = divs.Where(div => div.Text.Contains("0 of 1 credit")).ToList(); if (divsToClick.Count > 0) { divsToClick[0].Click(); Thread.Sleep(_minWait); if (divsToClick.Count > 1) { GetDailyOffer(); //we can only click one per page load or we'll get a stale element exception } } } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { //daily offer wasn't found } }
public void RegistrateWithValidData() { _driver.Url = "http://www.demoqa.com"; IWebElement registrateButton = _driver.FindElement(By.XPath("//*[@id=\"menu-item-374\"]/a")); registrateButton.Click(); IWebElement firstName = _driver.FindElement(By.Id("name_3_firstname")); Type(firstName, "Ventsislav"); IWebElement lastName = _driver.FindElement(By.Id("name_3_lastname")); Type(lastName, "Ivanov"); IWebElement matrialStatus = _driver.FindElement(By.XPath("//*[@id=\"pie_register\"]/li[2]/div/div/input[1]")); matrialStatus.Click(); List <IWebElement> hobbys = _driver.FindElements(By.Name("checkbox_5[]")).ToList(); hobbys[0].Click(); hobbys[1].Click(); IWebElement countryDropDown = _driver.FindElement(By.Id("dropdown_7")); SelectElement countryOption = new SelectElement(countryDropDown); countryOption.SelectByText("Bulgaria"); IWebElement mountDropDown = _driver.FindElement(By.Id("mm_date_8")); SelectElement mountOption = new SelectElement(mountDropDown); mountOption.SelectByValue("3"); IWebElement dayDropDown = _driver.FindElement(By.Id("dd_date_8")); SelectElement dayOption = new SelectElement(dayDropDown); dayOption.SelectByText("3"); IWebElement yearDropDown = _driver.FindElement(By.Id("yy_date_8")); SelectElement yearOption = new SelectElement(yearDropDown); yearOption.SelectByValue("1989"); IWebElement telephone = _driver.FindElement(By.Id("phone_9")); Type(telephone, "359999999999"); IWebElement userName = _driver.FindElement(By.Id("username")); //You need to change this for every test Type(userName, "BatmanForever"); IWebElement email = _driver.FindElement(By.Id("email_1")); //You need to change this for every test Type(email, "*****@*****.**"); IWebElement uploadPicButton = _driver.FindElement(By.Id("profile_pic_10")); uploadPicButton.Click(); _driver.SwitchTo().ActiveElement().SendKeys(Path.GetFullPath(@"..\..\..\logo.jpg")); WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(3)); IWebElement description = wait.Until(d => d.FindElement(By.Id("description"))); Type(description, "I think I'm Ready with this test!"); IWebElement password = _driver.FindElement(By.Id("password_2")); Type(password, "123456789"); IWebElement confirmPassword = _driver.FindElement(By.Id("confirm_password_password_2")); Type(confirmPassword, "123456789"); IWebElement submitButton = _driver.FindElement(By.Name("pie_submit")); submitButton.Click(); IWebElement registrationMessage = _driver.FindElement(By.ClassName("piereg_message")); Assert.IsTrue(registrateButton.Displayed); Assert.AreEqual("Thank you for your registration", registrationMessage.Text); StringAssert.Contains("Thank you", registrateButton.Text); }
private void button6_Click(object sender, EventArgs e)//парсить категории { IList <IWebElement> catlist = Browser.FindElements(By.ClassName("market_album_name_link")); SqlConnection Con = new SqlConnection(""); #region categoryadd /* for (int i = 0; i<catlist.Count;i++) * { * * SqlCommand addProduct = new SqlCommand("INSERT INTO CategoriesDostavka (categoryId, name, btnName) VALUES (@categoryId, @name, @btnName);", Con); * addProduct.Parameters.AddWithValue("@categoryId", i+1); * addProduct.Parameters.AddWithValue("@name", catlist[i].Text); * addProduct.Parameters.AddWithValue("@btnName", catlist[i].Text); * * addProduct.ExecuteNonQuery(); * }*/ #endregion #region updatecategory for (int j = 0; j < catlist.Count; j++) { Con.Open(); string catName = catlist[j].Text; SqlCommand getCatId = new SqlCommand("SELECT categoryId FROM CategoriesDostavka WHERE name = @name;", Con); getCatId.Parameters.AddWithValue("@name", catName); SqlDataReader rgetCatId = getCatId.ExecuteReader(); rgetCatId.Read(); int catId = Convert.ToInt32(rgetCatId["categoryId"]); rgetCatId.Close(); catlist[j].Click(); Thread.Sleep(3000); IJavaScriptExecutor js = (IJavaScriptExecutor)Browser; for (int k = 0; k < 10; k++) { js.ExecuteScript("window.scrollTo(0, document.body.scrollHeight)"); // Browser. Thread.Sleep(1000); } IList <IWebElement> prodlist = Browser.FindElements(By.ClassName("market_row")); foreach (var m in prodlist) { string[] article = m.FindElement(By.TagName("a")).GetAttribute("href").Split('_'); string id = article[1]; // IWebElement link = m.FindElement(By.CssSelector("#market_item5399830 > div > div.market_row_name > a")); SqlCommand updProd = new SqlCommand("UPDATE ProductsDostavka SET categoryId = @categoryId WHERE article = @article;", Con); updProd.Parameters.AddWithValue("@categoryId", catId); updProd.Parameters.AddWithValue("@article", id); updProd.ExecuteNonQuery(); } Thread.Sleep(1000); Browser.Navigate().GoToUrl("https://vk.com/market-85555931"); Thread.Sleep(3000); IWebElement morecat = Browser.FindElement(By.Id("ui_albums_load_more")); morecat.Click(); Thread.Sleep(3000); catlist = Browser.FindElements(By.ClassName("market_album_name_link")); Con.Close(); } MessageBox.Show("Готово!"); #endregion }
public T GoToSurvey <T>() where T : UiComponent, new() { return(NavigateTo <T>(By.ClassName("survey_action"))); }
public async Task CanUseEthereum() { using var s = SeleniumTester.Create("ETHEREUM", true); s.Server.ActivateETH(); await s.StartAsync(); s.RegisterNewUser(true); IWebElement syncSummary = null; TestUtils.Eventually(() => { syncSummary = s.Driver.FindElement(By.Id("modalDialog")); Assert.True(syncSummary.Displayed); }); var web3Link = syncSummary.FindElement(By.LinkText("Configure Web3")); web3Link.Click(); s.Driver.FindElement(By.Id("Web3ProviderUrl")).SendKeys("https://ropsten-rpc.linkpool.io"); s.Driver.FindElement(By.Id("saveButton")).Click(); s.AssertHappyMessage(); TestUtils.Eventually(() => { s.Driver.Navigate().Refresh(); s.Driver.AssertElementNotFound(By.Id("modalDialog")); }); var store = s.CreateNewStore(); s.Driver.FindElement(By.LinkText("Ethereum")).Click(); var seed = new Mnemonic(Wordlist.English); s.Driver.FindElement(By.Id("ModifyETH")).Click(); s.Driver.FindElement(By.Id("Seed")).SendKeys(seed.ToString()); s.SetCheckbox(s.Driver.FindElement(By.Id("StoreSeed")), true); s.SetCheckbox(s.Driver.FindElement(By.Id("Enabled")), true); s.Driver.FindElement(By.Id("SaveButton")).Click(); s.AssertHappyMessage(); s.Driver.FindElement(By.Id("ModifyUSDT20")).Click(); s.Driver.FindElement(By.Id("Seed")).SendKeys(seed.ToString()); s.SetCheckbox(s.Driver.FindElement(By.Id("StoreSeed")), true); s.SetCheckbox(s.Driver.FindElement(By.Id("Enabled")), true); s.Driver.FindElement(By.Id("SaveButton")).Click(); s.AssertHappyMessage(); var invoiceId = s.CreateInvoice(store.storeName, 10); s.GoToInvoiceCheckout(invoiceId); var currencyDropdownButton = s.Driver.WaitForElement(By.ClassName("payment__currencies")); Assert.Contains("ETH", currencyDropdownButton.Text); s.Driver.FindElement(By.Id("copy-tab")).Click(); var ethAddress = s.Driver.FindElements(By.ClassName("copySectionBox")) .Single(element => element.FindElement(By.TagName("label")).Text .Contains("Address", StringComparison.InvariantCultureIgnoreCase)).FindElement(By.TagName("input")) .GetAttribute("value"); currencyDropdownButton.Click(); var elements = s.Driver.FindElement(By.ClassName("vex-content")).FindElements(By.ClassName("vexmenuitem")); Assert.Equal(2, elements.Count); elements.Single(element => element.Text.Contains("USDT20")).Click(); s.Driver.FindElement(By.Id("copy-tab")).Click(); var usdtAddress = s.Driver.FindElements(By.ClassName("copySectionBox")) .Single(element => element.FindElement(By.TagName("label")).Text .Contains("Address", StringComparison.InvariantCultureIgnoreCase)).FindElement(By.TagName("input")) .GetAttribute("value"); Assert.Equal(usdtAddress, ethAddress); }
static void Main(string[] args) { using (var driver = new ChromeDriver()) { /* Initialization */ string projectTitle = ""; // Project Name string firstStepName = "InternalReview"; Console.WriteLine("Hi, please chose TMS project name: \n" + "1) Porsche BAL 2.0 \n" + "2) Porsche Cosima"); int projectChose = Int32.Parse(Console.ReadLine()); switch (projectChose) { case 1: projectTitle = "Porsche BAL 2.0"; break; case 2: projectTitle = "Porsche Cosima"; break; default: System.Environment.Exit(1); break; } Console.WriteLine("Now, please chose TMS setting name: \n" + "1) Internal Review; " + "2) Editing"); int settingChose = Int32.Parse(Console.ReadLine()); switch (settingChose) { case 1: firstStepName = "InternalReview"; break; case 2: firstStepName = "Editing"; break; default: System.Environment.Exit(1); break; } var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); driver.Manage().Window.Maximize(); driver.Navigate().GoToUrl("https://tms.lionbridge.com/"); ProjectsPage testPage = new ProjectsPage(driver, projectTitle); testPage.ClickChosenProject(); ParticularProjectPage testProjectPage = new ParticularProjectPage(driver); testProjectPage.ProfileClick(driver); testProjectPage.ChangeItemsPerPageMin(driver); testProjectPage.StatusClick(driver); StatusPage testStatusPage = new StatusPage(driver); testStatusPage.AssigneesClick(driver); AssigneesPage porscheAssigneesPage = new AssigneesPage(driver); if (porscheAssigneesPage.ChosenActivityClick(driver, firstStepName) != 1) { Console.WriteLine("There is no {0} steps!", firstStepName); return; } porscheAssigneesPage = new AssigneesPage(driver); PageBar testPageBar = new PageBar(driver); testPageBar.ItemsPerPageSetMaximalValue(driver); AssigneesAndJobs asob = new AssigneesAndJobs(driver); List <StatusAssigneeInfo> listOfStatusAssgineeInfo = new List <StatusAssigneeInfo>(); StatusAssigneeInfo auxiliary; foreach (var ass in asob.assigneesJobsList) { Console.WriteLine(ass.GetJobsName); } foreach (Assignee ass in asob.assigneesList) { for (int i = 0; i < ass.GetAssingeeJobsNumberInt; i++) { auxiliary = new StatusAssigneeInfo(ass, asob.assigneesJobsList.ElementAt(i)); listOfStatusAssgineeInfo.Add(auxiliary); } for (int i = 0; i < ass.GetAssingeeJobsNumberInt; i++) { asob.assigneesJobsList.RemoveAt(0); } Console.WriteLine(ass.GetAssigneeName + " " + ass.GetAssingeeJobsNumberInt); } foreach (var ass in listOfStatusAssgineeInfo) { Console.WriteLine(ass.jobName + " " + ass.reviewerName + " " + ass.sourceLanguage); } asob = new AssigneesAndJobs(driver); asob.TagMultipleJobs(driver, 0, asob.GetAssigneeJobsListSize - 1); ViewsMenu assigneesViewsMenu = new ViewsMenu(driver); assigneesViewsMenu.JobsView.ButtonClick(); JobsSectionJobs jsj = new JobsSectionJobs(driver); jsj.jobsPageBar.ItemsPerPageSetMaximalValue(driver); jsj = new JobsSectionJobs(driver); IReadOnlyCollection <IWebElement> auxiliaryCollection; ResultJob auxiliaryJobs = new ResultJob(); IWebElement jobsResultsContainer; IJavaScriptExecutor jse; string path = Path.Combine(Directory.GetCurrentDirectory(), "TestFile.csv"); using (StreamWriter sw = new StreamWriter(path)) { string[] values1 = { "Job Name", "Reviewer Name", "Translator Name", "Source Language", "Target Language", "Effort", "Wordcount" }; string line1 = String.Join(";", values1); sw.WriteLine(line1); foreach (var info in listOfStatusAssgineeInfo) { jse = (IJavaScriptExecutor)driver; jse.ExecuteScript("arguments[0].scrollIntoView();", jsj.GetJobElement(driver, info.jobName)); jsj.ShowHistoryOfJob(driver, info.jobName); JobHistoryFilter filter = new JobHistoryFilter(driver); filter.FiltersPanelInitialization(driver); filter.ChosenActivityClick(driver, "Translation"); filter = new JobHistoryFilter(driver); filter.FiltersPanelInitialization(driver); filter.SourceLanguageFilterClick(driver); filter.ChosenSourceLanguageClick(driver, info.sourceLanguage); filter = new JobHistoryFilter(driver); filter.FiltersPanelInitialization(driver); filter.TargetLanguageFilterClick(driver); filter.ChosenTargetLanguageClick(driver, info.targetLanguage); wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("r_L"))); auxiliaryCollection = driver.FindElements(By.Id("pup_avw")); jobsResultsContainer = auxiliaryCollection.ElementAt(0); auxiliaryCollection = jobsResultsContainer.FindElements(By.ClassName("r_L")); auxiliaryJobs = new ResultJob(auxiliaryCollection.ElementAt(0)); listOfStatusAssgineeInfo.ElementAt(listOfStatusAssgineeInfo.IndexOf(info)).TranslatorName = auxiliaryJobs.GetTranlatorName; PopUpBody popuPBody = new PopUpBody(driver); popuPBody.CloseButtonClick(driver); string[] values = { info.jobName, info.reviewerName, info.translatorName, info.sourceLanguage, info.targetLanguage, info.effort, info.wordcount }; string line = String.Join(";", values); sw.WriteLine(line); } sw.Flush(); } // iterates over the users //foreach (var info in listOfStatusAssgineeInfo) // { // creates an array of the user's values // string[] values = { info.jobName, info.reviewerName, info.translatorName, info.sourceLanguage, info.targetLanguage }; // creates a new line // string line = String.Join(";", values); // writes the line // sw.WriteLine(line); // } // flushes the buffer // sw.Flush(); // } } }
public string AccesDiscountCode(IWebDriver driver) { driver.FindElements(By.ClassName("nav-item"))[7].Click(); return(driver.Url); }