diff --git a/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/App.config b/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/App.config index 4a39fd3b..7dfc4876 100644 --- a/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/App.config +++ b/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/App.config @@ -1,4 +1,4 @@ - + - + - \ No newline at end of file + diff --git a/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/CodeProjectStatisticsCalculator.csproj b/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/CodeProjectStatisticsCalculator.csproj index be801dde..f955464e 100644 --- a/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/CodeProjectStatisticsCalculator.csproj +++ b/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/CodeProjectStatisticsCalculator.csproj @@ -1,4 +1,4 @@ - + @@ -9,11 +9,12 @@ Properties CodeProjectStatisticsCalculator CodeProjectStatisticsCalculator - v4.5.2 + v4.8 512 true + AnyCPU diff --git a/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/Pages/ArticlesPage/ArticlesPage.Map.cs b/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/Pages/ArticlesPage/ArticlesPage.Map.cs index 080c5438..e16a34ac 100644 --- a/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/Pages/ArticlesPage/ArticlesPage.Map.cs +++ b/dotnet/AutomationTools-Series/CodeProjectStatisticsCalculator/Pages/ArticlesPage/ArticlesPage.Map.cs @@ -1,5 +1,5 @@ -// -// Copyright 2016 Automate The Planet Ltd. +// +// Copyright 2023 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @@ -10,31 +10,14 @@ // limitations under the License. // // Anton Angelov -// http://automatetheplanet.com/ +// https://automatetheplanet.com/ +using NUnit; -using OpenQA.Selenium; -using System.Collections.ObjectModel; - -namespace CodeProjectStatisticsCalculator.Pages.ItemPage +namespace $rootnamespace$; +public partial class $safeitemname$ { - public partial class ArticlesPage + public void AssertSomething() { - public ReadOnlyCollection ArticlesRows - { - get - { - return Driver.FindElements(By.XPath("//tr[contains(@id,'CAR_MainArticleRow')]")); - } - } - - public IWebElement GetArticleStatisticsElement(IWebElement articleRow) - { - return articleRow.FindElement(By.CssSelector("div[id$='CAR_SbD']")); - } - - public IWebElement GetArticleTitleElement(IWebElement articleRow) - { - return articleRow.FindElement(By.CssSelector("a[id$='CAR_Title']")); - } + Assert.IsTrue(true); } } \ No newline at end of file diff --git a/dotnet/AutomationTools-Series/GithubActions/CheckoutTests.cs b/dotnet/AutomationTools-Series/GithubActions/CheckoutTests.cs index b69116b5..fd12d759 100644 --- a/dotnet/AutomationTools-Series/GithubActions/CheckoutTests.cs +++ b/dotnet/AutomationTools-Series/GithubActions/CheckoutTests.cs @@ -6,125 +6,37 @@ using WebDriverManager.DriverConfigs.Impl; using WebDriverManager.Helpers; -namespace GithubActions +namespace GithubActions; + +public class CheckoutTests { - public class CheckoutTests - { - private IWebDriver _driver; - private CheckoutPage _checkoutPage; - - [SetUp] - public void Setup() - { - new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser); - ChromeOptions options = new ChromeOptions(); - options.AddArguments("--headless"); - _driver = new ChromeDriver(options); - _checkoutPage = new CheckoutPage(_driver); - _checkoutPage.Navigate(); - } - - [TearDown] - public void TearDown() - { - _driver.Quit(); - } - - [Test] - public void FormSent_When_InfoValid() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "Angelov", - Username: "aangelov", - Email: "info@berlinspaceflowers.com", - Address1: "1 Willi Brandt Avenue Tiergarten", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "12/23", - CardCVV: "123"); - - _checkoutPage.FillInfo(clientInfo); - - _checkoutPage.AssertFormSent(); - } - - [Test] - public void ValidatedFirstName_When_FirstNameNotSet() - { - var clientInfo = new ClientInfo(FirstName: "", - LastName: "Angelov", - Username: "aangelov", - Email: "info@berlinspaceflowers.com", - Address1: "1 Willi Brandt Avenue Tiergarten", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "12/23", - CardCVV: "123"); - - _checkoutPage.FillInfo(clientInfo); - - _checkoutPage.AssertFirstNameValidationDisplayed(); - } - - [Test] - public void ValidatedLastName_When_FirstNameNotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "", - Username: "aangelov", - Email: "info@berlinspaceflowers.com", - Address1: "1 Willi Brandt Avenue Tiergarten", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "12/23", - CardCVV: "123"); - - _checkoutPage.FillInfo(clientInfo); - - _checkoutPage.AssertLastNameValidationDisplayed(); - } - - [Test] - public void ValidatedUsername_When_UsernameNotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "Angelov", - Username: "", - Email: "info@berlinspaceflowers.com", - Address1: "1 Willi Brandt Avenue Tiergarten", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "12/23", - CardCVV: "123"); + private IWebDriver _driver; + private CheckoutPage _checkoutPage; - _checkoutPage.FillInfo(clientInfo); + [SetUp] + public void Setup() + { + new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser); + ChromeOptions options = new ChromeOptions(); + options.AddArguments("--headless"); + _driver = new ChromeDriver(options); + _checkoutPage = new CheckoutPage(_driver); + _checkoutPage.Navigate(); + } - _checkoutPage.AssertUsernameValidationDisplayed(); - } + [TearDown] + public void TearDown() + { + _driver.Quit(); + } - [Test] - public void ValidatedEmail_When_EmailNotValid() - { - var clientInfo = new ClientInfo(FirstName: "Anton", + [Test] + public void FormSent_When_InfoValid() + { + var clientInfo = new ClientInfo(FirstName: "Anton", LastName: "Angelov", Username: "aangelov", - Email: "asdasd", + Email: "info@berlinspaceflowers.com", Address1: "1 Willi Brandt Avenue Tiergarten", Address2: "Lützowplatz 17", Country: 1, @@ -135,37 +47,15 @@ public void ValidatedEmail_When_EmailNotValid() CardExpiration: "12/23", CardCVV: "123"); - _checkoutPage.FillInfo(clientInfo); - - _checkoutPage.AssertEmailValidationDisplayed(); - } - - [Test] - public void ValidatedAddress1_When_Address1NotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "Angelov", - Username: "aangelov", - Email: "info@berlinspaceflowers.com", - Address1: "", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "12/23", - CardCVV: "123"); - - _checkoutPage.FillInfo(clientInfo); - - _checkoutPage.AssertAddress1ValidationDisplayed(); - } - - [Test] - public void ValidatedZip_When_ZipNotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertFormSent(); + } + + [Test] + public void ValidatedFirstName_When_FirstNameNotSet() + { + var clientInfo = new ClientInfo(FirstName: "", LastName: "Angelov", Username: "aangelov", Email: "info@berlinspaceflowers.com", @@ -173,22 +63,22 @@ public void ValidatedZip_When_ZipNotSet() Address2: "Lützowplatz 17", Country: 1, State: 1, - Zip: "", + Zip: "10115", CardName: "Anton Angelov", CardNumber: "1234567890123456", CardExpiration: "12/23", CardCVV: "123"); - _checkoutPage.FillInfo(clientInfo); + _checkoutPage.FillInfo(clientInfo); - _checkoutPage.AssertZipValidationDisplayed(); - } + _checkoutPage.AssertFirstNameValidationDisplayed(); + } - [Test] - public void ValidatedCardName_When_CardNameNotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "Angelov", + [Test] + public void ValidatedLastName_When_FirstNameNotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "", Username: "aangelov", Email: "info@berlinspaceflowers.com", Address1: "1 Willi Brandt Avenue Tiergarten", @@ -196,58 +86,167 @@ public void ValidatedCardName_When_CardNameNotSet() Country: 1, State: 1, Zip: "10115", - CardName: "", + CardName: "Anton Angelov", CardNumber: "1234567890123456", CardExpiration: "12/23", CardCVV: "123"); - _checkoutPage.FillInfo(clientInfo); + _checkoutPage.FillInfo(clientInfo); - _checkoutPage.AssertCardNameValidationDisplayed(); - } + _checkoutPage.AssertLastNameValidationDisplayed(); + } - [Test] - public void ValidatedCardExpiration_When_CardExpirationNotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "Angelov", - Username: "aangelov", - Email: "info@berlinspaceflowers.com", - Address1: "1 Willi Brandt Avenue Tiergarten", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "", - CardCVV: "123"); + [Test] + public void ValidatedUsername_When_UsernameNotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "", + Email: "info@berlinspaceflowers.com", + Address1: "1 Willi Brandt Avenue Tiergarten", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "10115", + CardName: "Anton Angelov", + CardNumber: "1234567890123456", + CardExpiration: "12/23", + CardCVV: "123"); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertUsernameValidationDisplayed(); + } - _checkoutPage.FillInfo(clientInfo); + [Test] + public void ValidatedEmail_When_EmailNotValid() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "aangelov", + Email: "asdasd", + Address1: "1 Willi Brandt Avenue Tiergarten", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "10115", + CardName: "Anton Angelov", + CardNumber: "1234567890123456", + CardExpiration: "12/23", + CardCVV: "123"); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertEmailValidationDisplayed(); + } - _checkoutPage.AssertCardExpirationValidationDisplayed(); - } + [Test] + public void ValidatedAddress1_When_Address1NotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "aangelov", + Email: "info@berlinspaceflowers.com", + Address1: "", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "10115", + CardName: "Anton Angelov", + CardNumber: "1234567890123456", + CardExpiration: "12/23", + CardCVV: "123"); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertAddress1ValidationDisplayed(); + } - [Test] - public void ValidatedCardCVV_When_CardCVVNotSet() - { - var clientInfo = new ClientInfo(FirstName: "Anton", - LastName: "Angelov", - Username: "aangelov", - Email: "info@berlinspaceflowers.com", - Address1: "1 Willi Brandt Avenue Tiergarten", - Address2: "Lützowplatz 17", - Country: 1, - State: 1, - Zip: "10115", - CardName: "Anton Angelov", - CardNumber: "1234567890123456", - CardExpiration: "12/23", - CardCVV: ""); + [Test] + public void ValidatedZip_When_ZipNotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "aangelov", + Email: "info@berlinspaceflowers.com", + Address1: "1 Willi Brandt Avenue Tiergarten", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "", + CardName: "Anton Angelov", + CardNumber: "1234567890123456", + CardExpiration: "12/23", + CardCVV: "123"); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertZipValidationDisplayed(); + } + + [Test] + public void ValidatedCardName_When_CardNameNotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "aangelov", + Email: "info@berlinspaceflowers.com", + Address1: "1 Willi Brandt Avenue Tiergarten", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "10115", + CardName: "", + CardNumber: "1234567890123456", + CardExpiration: "12/23", + CardCVV: "123"); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertCardNameValidationDisplayed(); + } - _checkoutPage.FillInfo(clientInfo); + [Test] + public void ValidatedCardExpiration_When_CardExpirationNotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "aangelov", + Email: "info@berlinspaceflowers.com", + Address1: "1 Willi Brandt Avenue Tiergarten", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "10115", + CardName: "Anton Angelov", + CardNumber: "1234567890123456", + CardExpiration: "", + CardCVV: "123"); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertCardExpirationValidationDisplayed(); + } - _checkoutPage.AssertCardCVVValidationDisplayed(); - } + [Test] + public void ValidatedCardCVV_When_CardCVVNotSet() + { + var clientInfo = new ClientInfo(FirstName: "Anton", + LastName: "Angelov", + Username: "aangelov", + Email: "info@berlinspaceflowers.com", + Address1: "1 Willi Brandt Avenue Tiergarten", + Address2: "Lützowplatz 17", + Country: 1, + State: 1, + Zip: "10115", + CardName: "Anton Angelov", + CardNumber: "1234567890123456", + CardExpiration: "12/23", + CardCVV: ""); + + _checkoutPage.FillInfo(clientInfo); + + _checkoutPage.AssertCardCVVValidationDisplayed(); } } \ No newline at end of file diff --git a/dotnet/AutomationTools-Series/GithubActions/GithubActions.csproj b/dotnet/AutomationTools-Series/GithubActions/GithubActions.csproj index 3c17208e..40e40269 100644 --- a/dotnet/AutomationTools-Series/GithubActions/GithubActions.csproj +++ b/dotnet/AutomationTools-Series/GithubActions/GithubActions.csproj @@ -2,12 +2,12 @@ - - - - - - + + + + + + diff --git a/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Assertions.cs b/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Assertions.cs index 392924d4..4f1f331a 100644 --- a/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Assertions.cs +++ b/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Assertions.cs @@ -6,73 +6,72 @@ using NUnit.Framework; using OpenQA.Selenium; -namespace GithubActions.Pages +namespace GithubActions.Pages; + +public partial class CheckoutPage { - public partial class CheckoutPage + public void AssertFormSent() { - public void AssertFormSent() - { - Assert.True(_driver.Url.Contains("paymentMethod=on"), "Form not sent"); - } + Assert.True(_driver.Url.Contains("paymentMethod=on"), "Form not sent"); + } - public void AssertFirstNameValidationDisplayed() - { - Assert.True(FirstNameValidation.Displayed); - } + public void AssertFirstNameValidationDisplayed() + { + Assert.True(FirstNameValidation.Displayed); + } - public void AssertLastNameValidationDisplayed() - { - Assert.True(LastNameValidation.Displayed); - } + public void AssertLastNameValidationDisplayed() + { + Assert.True(LastNameValidation.Displayed); + } - public void AssertUsernameValidationDisplayed() - { - Assert.True(UsernameValidation.Displayed); - } + public void AssertUsernameValidationDisplayed() + { + Assert.True(UsernameValidation.Displayed); + } - public void AssertEmailValidationDisplayed() - { - Assert.True(EmailValidation.Displayed); - } + public void AssertEmailValidationDisplayed() + { + Assert.True(EmailValidation.Displayed); + } - public void AssertAddress1ValidationDisplayed() - { - Assert.True(Address1Validation.Displayed); - } + public void AssertAddress1ValidationDisplayed() + { + Assert.True(Address1Validation.Displayed); + } - public void AssertCountryValidationDisplayed() - { - Assert.True(CountryValidation.Displayed); - } + public void AssertCountryValidationDisplayed() + { + Assert.True(CountryValidation.Displayed); + } - public void AssertStateValidationDisplayed() - { - Assert.True(StateValidation.Displayed); - } + public void AssertStateValidationDisplayed() + { + Assert.True(StateValidation.Displayed); + } - public void AssertZipValidationDisplayed() - { - Assert.True(ZipValidation.Displayed); - } + public void AssertZipValidationDisplayed() + { + Assert.True(ZipValidation.Displayed); + } - public void AssertCardNameValidationDisplayed() - { - Assert.True(CardNameValidation.Displayed); - } + public void AssertCardNameValidationDisplayed() + { + Assert.True(CardNameValidation.Displayed); + } - public void AssertCardNumberValidationDisplayed() - { - Assert.True(CardNumberValidation.Displayed); - } + public void AssertCardNumberValidationDisplayed() + { + Assert.True(CardNumberValidation.Displayed); + } - public void AssertCardExpirationValidationDisplayed() - { - Assert.True(CardExpirationValidation.Displayed); - } + public void AssertCardExpirationValidationDisplayed() + { + Assert.True(CardExpirationValidation.Displayed); + } - public void AssertCardCVVValidationDisplayed() - { - Assert.True(CardCVVValidation.Displayed); - } + public void AssertCardCVVValidationDisplayed() + { + Assert.True(CardCVVValidation.Displayed); } } diff --git a/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Map.cs b/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Map.cs index 8860ea01..5c6eb707 100644 --- a/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Map.cs +++ b/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.Map.cs @@ -6,35 +6,34 @@ using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; -namespace GithubActions.Pages +namespace GithubActions.Pages; + +public partial class CheckoutPage { - public partial class CheckoutPage - { - public IWebElement FirstName => _driver.FindElement(By.Id("firstName")); - public IWebElement FirstNameValidation => _driver.FindElement(By.CssSelector("#firstName ~ .invalid-feedback")); - public IWebElement LastName => _driver.FindElement(By.Id("lastName")); - public IWebElement LastNameValidation => _driver.FindElement(By.CssSelector("#lastName ~ .invalid-feedback")); - public IWebElement Username => _driver.FindElement(By.Id("username")); - public IWebElement UsernameValidation => _driver.FindElement(By.CssSelector("#username ~ .invalid-feedback")); - public IWebElement Email => _driver.FindElement(By.Id("email")); - public IWebElement EmailValidation => _driver.FindElement(By.CssSelector("#email ~ .invalid-feedback")); - public IWebElement Address1 => _driver.FindElement(By.Id("address")); - public IWebElement Address1Validation => _driver.FindElement(By.CssSelector("#address ~ .invalid-feedback")); - public IWebElement Address2 => _driver.FindElement(By.Id("address2")); - public SelectElement Country => new SelectElement(_driver.FindElement(By.Id("country"))); - public IWebElement CountryValidation => _driver.FindElement(By.CssSelector("#country ~ .invalid-feedback")); - public SelectElement State => new SelectElement(_driver.FindElement(By.Id("state"))); - public IWebElement StateValidation => _driver.FindElement(By.CssSelector("#state ~ .invalid-feedback")); - public IWebElement Zip => _driver.FindElement(By.Id("zip")); - public IWebElement ZipValidation => _driver.FindElement(By.CssSelector("#zip ~ .invalid-feedback")); - public IWebElement CardName => _driver.FindElement(By.Id("cc-name")); - public IWebElement CardNameValidation => _driver.FindElement(By.CssSelector("#cc-name ~ .invalid-feedback")); - public IWebElement CardNumber => _driver.FindElement(By.Id("cc-number")); - public IWebElement CardNumberValidation => _driver.FindElement(By.CssSelector("#cc-number ~ .invalid-feedback")); - public IWebElement CardExpiration => _driver.FindElement(By.Id("cc-expiration")); - public IWebElement CardExpirationValidation => _driver.FindElement(By.CssSelector("#cc-expiration ~ .invalid-feedback")); - public IWebElement CardCVV => _driver.FindElement(By.Id("cc-cvv")); - public IWebElement CardCVVValidation => _driver.FindElement(By.CssSelector("#cc-cvv ~ .invalid-feedback")); - public IWebElement SubmitButton => _driver.FindElement(By.XPath("//button[text()='Continue to checkout']")); - } + public IWebElement FirstName => _driver.FindElement(By.Id("firstName")); + public IWebElement FirstNameValidation => _driver.FindElement(By.CssSelector("#firstName ~ .invalid-feedback")); + public IWebElement LastName => _driver.FindElement(By.Id("lastName")); + public IWebElement LastNameValidation => _driver.FindElement(By.CssSelector("#lastName ~ .invalid-feedback")); + public IWebElement Username => _driver.FindElement(By.Id("username")); + public IWebElement UsernameValidation => _driver.FindElement(By.CssSelector("#username ~ .invalid-feedback")); + public IWebElement Email => _driver.FindElement(By.Id("email")); + public IWebElement EmailValidation => _driver.FindElement(By.CssSelector("#email ~ .invalid-feedback")); + public IWebElement Address1 => _driver.FindElement(By.Id("address")); + public IWebElement Address1Validation => _driver.FindElement(By.CssSelector("#address ~ .invalid-feedback")); + public IWebElement Address2 => _driver.FindElement(By.Id("address2")); + public SelectElement Country => new SelectElement(_driver.FindElement(By.Id("country"))); + public IWebElement CountryValidation => _driver.FindElement(By.CssSelector("#country ~ .invalid-feedback")); + public SelectElement State => new SelectElement(_driver.FindElement(By.Id("state"))); + public IWebElement StateValidation => _driver.FindElement(By.CssSelector("#state ~ .invalid-feedback")); + public IWebElement Zip => _driver.FindElement(By.Id("zip")); + public IWebElement ZipValidation => _driver.FindElement(By.CssSelector("#zip ~ .invalid-feedback")); + public IWebElement CardName => _driver.FindElement(By.Id("cc-name")); + public IWebElement CardNameValidation => _driver.FindElement(By.CssSelector("#cc-name ~ .invalid-feedback")); + public IWebElement CardNumber => _driver.FindElement(By.Id("cc-number")); + public IWebElement CardNumberValidation => _driver.FindElement(By.CssSelector("#cc-number ~ .invalid-feedback")); + public IWebElement CardExpiration => _driver.FindElement(By.Id("cc-expiration")); + public IWebElement CardExpirationValidation => _driver.FindElement(By.CssSelector("#cc-expiration ~ .invalid-feedback")); + public IWebElement CardCVV => _driver.FindElement(By.Id("cc-cvv")); + public IWebElement CardCVVValidation => _driver.FindElement(By.CssSelector("#cc-cvv ~ .invalid-feedback")); + public IWebElement SubmitButton => _driver.FindElement(By.XPath("//button[text()='Continue to checkout']")); } diff --git a/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.cs b/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.cs index 3f86b182..50e5025d 100644 --- a/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.cs +++ b/dotnet/AutomationTools-Series/GithubActions/Pages/CheckoutPage.cs @@ -5,44 +5,43 @@ using System.Threading.Tasks; using OpenQA.Selenium; -namespace GithubActions.Pages +namespace GithubActions.Pages; + +public partial class CheckoutPage { - public partial class CheckoutPage - { - private const string URL = "https://getbootstrap.com/docs/5.0/examples/checkout/"; - private IWebDriver _driver; + private const string URL = "https://getbootstrap.com/docs/5.0/examples/checkout/"; + private IWebDriver _driver; - public CheckoutPage(IWebDriver driver) - { - _driver = driver; - } + public CheckoutPage(IWebDriver driver) + { + _driver = driver; + } - public void Navigate() - { - _driver.Navigate().GoToUrl(URL); - } + public void Navigate() + { + _driver.Navigate().GoToUrl(URL); + } - public void FillInfo(ClientInfo clientInfo) - { - FirstName.SendKeys(clientInfo.FirstName); - LastName.SendKeys(clientInfo.LastName); - Username.SendKeys(clientInfo.Username); - Email.SendKeys(clientInfo.Email); - Address1.SendKeys(clientInfo.Address1); - Address2.SendKeys(clientInfo.Address2); - Country.SelectByIndex(clientInfo.Country); - State.SelectByIndex(clientInfo.State); - Zip.SendKeys(clientInfo.Zip); - CardName.SendKeys(clientInfo.CardName); - CardNumber.SendKeys(clientInfo.CardNumber); - CardExpiration.SendKeys(clientInfo.CardExpiration); - CardCVV.SendKeys(clientInfo.CardCVV); - ClickSubmitButton(); - } + public void FillInfo(ClientInfo clientInfo) + { + FirstName.SendKeys(clientInfo.FirstName); + LastName.SendKeys(clientInfo.LastName); + Username.SendKeys(clientInfo.Username); + Email.SendKeys(clientInfo.Email); + Address1.SendKeys(clientInfo.Address1); + Address2.SendKeys(clientInfo.Address2); + Country.SelectByIndex(clientInfo.Country); + State.SelectByIndex(clientInfo.State); + Zip.SendKeys(clientInfo.Zip); + CardName.SendKeys(clientInfo.CardName); + CardNumber.SendKeys(clientInfo.CardNumber); + CardExpiration.SendKeys(clientInfo.CardExpiration); + CardCVV.SendKeys(clientInfo.CardCVV); + ClickSubmitButton(); + } - private void ClickSubmitButton() - { - ((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].click();", SubmitButton); - } + private void ClickSubmitButton() + { + ((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].click();", SubmitButton); } } diff --git a/dotnet/AutomationTools-Series/GithubActions/Pages/ClientInfo.cs b/dotnet/AutomationTools-Series/GithubActions/Pages/ClientInfo.cs index 05aa7a73..ebf226da 100644 --- a/dotnet/AutomationTools-Series/GithubActions/Pages/ClientInfo.cs +++ b/dotnet/AutomationTools-Series/GithubActions/Pages/ClientInfo.cs @@ -4,19 +4,18 @@ using System.Text; using System.Threading.Tasks; -namespace GithubActions.Pages -{ - public record ClientInfo(string FirstName, - string LastName, - string Username, - string Email, - string Address1, - string Address2, - int Country, - int State, - string Zip, - string CardName, - string CardNumber, - string CardExpiration, - string CardCVV); -} +namespace GithubActions.Pages; + +public record ClientInfo(string FirstName, + string LastName, + string Username, + string Email, + string Address1, + string Address2, + int Country, + int State, + string Zip, + string CardName, + string CardNumber, + string CardExpiration, + string CardCVV); diff --git a/dotnet/AutomationTools-Series/SofwareManagementAutomationWindows/SoftwareAutomationService.cs b/dotnet/AutomationTools-Series/SofwareManagementAutomationWindows/SoftwareAutomationService.cs index 83b67254..cfb9c5f9 100644 --- a/dotnet/AutomationTools-Series/SofwareManagementAutomationWindows/SoftwareAutomationService.cs +++ b/dotnet/AutomationTools-Series/SofwareManagementAutomationWindows/SoftwareAutomationService.cs @@ -54,6 +54,7 @@ public static void InstallRequiredSoftware() throw new InvalidOperationException("To use BELLATRIX.MachineAutomation please start Visual Studio in Administrative Mode.", e); } } + } } } diff --git a/dotnet/MobileAutomation-Series/GettingStartedAppiumAndroidWindowsCSharp/HybridAppTests.cs b/dotnet/MobileAutomation-Series/GettingStartedAppiumAndroidWindowsCSharp/HybridAppTests.cs index e0f6048d..f81efd67 100644 --- a/dotnet/MobileAutomation-Series/GettingStartedAppiumAndroidWindowsCSharp/HybridAppTests.cs +++ b/dotnet/MobileAutomation-Series/GettingStartedAppiumAndroidWindowsCSharp/HybridAppTests.cs @@ -21,73 +21,72 @@ using System; using System.IO; -namespace GettingStartedAppiumAndroidWindows +namespace GettingStartedAppiumAndroidWindows; + +[TestClass] +public class HybridAppTests { - [TestClass] - public class HybridAppTests - { - private static AndroidDriver _driver; - private static AppiumLocalService _appiumLocalService; + private static AndroidDriver _driver; + private static AppiumLocalService _appiumLocalService; - [ClassInitialize] - public static void ClassInitialize(TestContext context) - { - _appiumLocalService = new AppiumServiceBuilder().UsingAnyFreePort().Build(); - _appiumLocalService.Start(); - string testAppPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "selendroid-test-app-0.10.0.apk"); - var appiumOptions = new AppiumOptions(); - appiumOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Android_Accelerated_x86_Oreo"); - appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android"); - appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "7.1"); - appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AppPackage, "io.selendroid.testapp"); - appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AppActivity, "HomeScreenActivity"); + [ClassInitialize] + public static void ClassInitialize(TestContext context) + { + _appiumLocalService = new AppiumServiceBuilder().UsingAnyFreePort().Build(); + _appiumLocalService.Start(); + string testAppPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "selendroid-test-app-0.10.0.apk"); + var appiumOptions = new AppiumOptions(); + appiumOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, "Android_Accelerated_x86_Oreo"); + appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android"); + appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "7.1"); + appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AppPackage, "io.selendroid.testapp"); + appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AppActivity, "HomeScreenActivity"); - _driver = new AndroidDriver(_appiumLocalService, appiumOptions); - _driver.CloseApp(); - } + _driver = new AndroidDriver(_appiumLocalService, appiumOptions); + _driver.CloseApp(); + } - [TestInitialize] - public void TestInitialize() + [TestInitialize] + public void TestInitialize() + { + if (_driver != null) { - if (_driver != null) - { - _driver.LaunchApp(); - } + _driver.LaunchApp(); } + } - [TestCleanup] - public void TestCleanup() + [TestCleanup] + public void TestCleanup() + { + if (_driver != null) { - if (_driver != null) - { - _driver.CloseApp(); - } + _driver.CloseApp(); } + } - [ClassCleanup] - public static void ClassCleanup() - { - _appiumLocalService.Dispose(); - } + [ClassCleanup] + public static void ClassCleanup() + { + _appiumLocalService.Dispose(); + } - [TestMethod] - public void WebViewTestCase() - { - var webButton = _driver.FindElementById("io.selendroid.testapp:id/buttonStartWebview"); - webButton.Click(); + [TestMethod] + public void WebViewTestCase() + { + var webButton = _driver.FindElementById("io.selendroid.testapp:id/buttonStartWebview"); + webButton.Click(); - var contexts = ((IContextAware)_driver).Contexts; - for (int i = 0; i < contexts.Count; i++) + var contexts = ((IContextAware)_driver).Contexts; + for (int i = 0; i < contexts.Count; i++) + { + if (contexts[i].Contains("WEBVIEW")) { - if (contexts[i].Contains("WEBVIEW")) - { - ((IContextAware)_driver).Context = contexts[i]; - break; - } + ((IContextAware)_driver).Context = contexts[i]; + break; } - - var sendMeYourNameButton = _driver.FindElement(By.XPath("/html/body/form/div/input[2]")); - sendMeYourNameButton.Click(); } + + var sendMeYourNameButton = _driver.FindElement(By.XPath("/html/body/form/div/input[2]")); + sendMeYourNameButton.Click(); } } diff --git a/dotnet/WebAutomation-Series/ExecuteUiTestsLambdaTest/ExecuteUiTestsLambdaTest.csproj b/dotnet/WebAutomation-Series/ExecuteUiTestsLambdaTest/ExecuteUiTestsLambdaTest.csproj index 15d307e1..16be4412 100644 --- a/dotnet/WebAutomation-Series/ExecuteUiTestsLambdaTest/ExecuteUiTestsLambdaTest.csproj +++ b/dotnet/WebAutomation-Series/ExecuteUiTestsLambdaTest/ExecuteUiTestsLambdaTest.csproj @@ -2,11 +2,11 @@ - - + + - + all diff --git a/dotnet/WebAutomation-Series/ExecuteUiTestsSauceLabs/RunTestsInCloud.cs b/dotnet/WebAutomation-Series/ExecuteUiTestsSauceLabs/RunTestsInCloud.cs index 47f69061..7c96a1bf 100644 --- a/dotnet/WebAutomation-Series/ExecuteUiTestsSauceLabs/RunTestsInCloud.cs +++ b/dotnet/WebAutomation-Series/ExecuteUiTestsSauceLabs/RunTestsInCloud.cs @@ -21,74 +21,73 @@ using OpenQA.Selenium.Support.UI; using ExpectedConditions = SeleniumExtras.WaitHelpers.ExpectedConditions; -namespace ExecuteUiTestsSauceLabs +namespace ExecuteUiTestsSauceLabs; + +[TestFixture] +public class RunTestsInCloud { - [TestFixture] - public class RunTestsInCloud + private string _username = "autoCloudTester"; + private string _authkey = "70dccdcf-a9fd-4f55-aa07-12b051f6c83e"; + private IWebDriver _driver; + + [SetUp] + public void SetupTest() { - private string _username = "autoCloudTester"; - private string _authkey = "70dccdcf-a9fd-4f55-aa07-12b051f6c83e"; - private IWebDriver _driver; + var options = new ChromeOptions(); + options.AddAdditionalCapability("browserstack.debug", "true"); + options.AddAdditionalCapability("build", "1.0"); - [SetUp] - public void SetupTest() - { - var options = new ChromeOptions(); - options.AddAdditionalCapability("browserstack.debug", "true"); - options.AddAdditionalCapability("build", "1.0"); + options.AddAdditionalCapability("browserName", "Chrome"); + options.AddAdditionalCapability("platform", "Windows 8.1"); + options.AddAdditionalCapability("version", "49.0"); + options.AddAdditionalCapability("screenResolution", "1280x800"); - options.AddAdditionalCapability("browserName", "Chrome"); - options.AddAdditionalCapability("platform", "Windows 8.1"); - options.AddAdditionalCapability("version", "49.0"); - options.AddAdditionalCapability("screenResolution", "1280x800"); + options.AddAdditionalCapability("username", _username); + options.AddAdditionalCapability("accessKey", _authkey); + options.AddAdditionalCapability("name", TestContext.CurrentContext.Test.Name); - options.AddAdditionalCapability("username", _username); - options.AddAdditionalCapability("accessKey", _authkey); - options.AddAdditionalCapability("name", TestContext.CurrentContext.Test.Name); + _driver = new RemoteWebDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), options); + _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30); + } - _driver = new RemoteWebDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), options); - _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30); + [TearDown] + public void TeardownTest() + { + var passed = TestContext.CurrentContext.Result.Outcome == ResultState.Success; + try + { + // Logs the result to Sauce Labs + ((IJavaScriptExecutor)_driver).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed")); } - - [TearDown] - public void TeardownTest() + finally { - var passed = TestContext.CurrentContext.Result.Outcome == ResultState.Success; - try - { - // Logs the result to Sauce Labs - ((IJavaScriptExecutor)_driver).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed")); - } - finally - { - _driver.Quit(); - } + _driver.Quit(); } + } - [Test] - public void ScrollFocusToControl_InCloud_ShouldFail() - { - _driver.Navigate().GoToUrl(@"https://automatetheplanet.com/compelling-sunday-14022016/"); - var link = _driver.FindElement(By.PartialLinkText("Previous post")); - var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; - ((IJavaScriptExecutor)_driver).ExecuteScript(jsToBeExecuted); - link.Click(); + [Test] + public void ScrollFocusToControl_InCloud_ShouldFail() + { + _driver.Navigate().GoToUrl(@"https://automatetheplanet.com/compelling-sunday-14022016/"); + var link = _driver.FindElement(By.PartialLinkText("Previous post")); + var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; + ((IJavaScriptExecutor)_driver).ExecuteScript(jsToBeExecuted); + link.Click(); - Assert.AreEqual("10 Advanced WebDriver Tips and Tricks - Part 1", _driver.Title); - } + Assert.AreEqual("10 Advanced WebDriver Tips and Tricks - Part 1", _driver.Title); + } - [Test] - public void ScrollFocusToControl_InCloud_ShouldPass() - { - _driver.Navigate().GoToUrl(@"https://automatetheplanet.com/multiple-files-page-objects-item-templates/"); - var link = _driver.FindElement(By.PartialLinkText("TFS Test API")); - var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; - ((IJavaScriptExecutor)_driver).ExecuteScript(jsToBeExecuted); - var wait = new WebDriverWait(_driver, TimeSpan.FromMinutes(1)); - var clickableElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.PartialLinkText("TFS Test API"))); - clickableElement.Click(); + [Test] + public void ScrollFocusToControl_InCloud_ShouldPass() + { + _driver.Navigate().GoToUrl(@"https://automatetheplanet.com/multiple-files-page-objects-item-templates/"); + var link = _driver.FindElement(By.PartialLinkText("TFS Test API")); + var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; + ((IJavaScriptExecutor)_driver).ExecuteScript(jsToBeExecuted); + var wait = new WebDriverWait(_driver, TimeSpan.FromMinutes(1)); + var clickableElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.PartialLinkText("TFS Test API"))); + clickableElement.Click(); - Assert.AreEqual("TFS Test API Archives - Automate The Planet", _driver.Title); - } + Assert.AreEqual("TFS Test API Archives - Automate The Planet", _driver.Title); } } \ No newline at end of file diff --git a/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/RunTestsInSelenoid.cs b/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/RunTestsInSelenoid.cs index 1cb39b7a..50d6626e 100644 --- a/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/RunTestsInSelenoid.cs +++ b/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/RunTestsInSelenoid.cs @@ -20,115 +20,114 @@ using OpenQA.Selenium.Support.Extensions; using OpenQA.Selenium.Support.UI; -namespace WebDriverTestsDockerSelenoid +namespace WebDriverTestsDockerSelenoid; + +[TestFixture] +[Parallelizable(ParallelScope.Children)] +public class RunTestsInSelenoid { - [TestFixture] - [Parallelizable(ParallelScope.Children)] - public class RunTestsInSelenoid + private IWebDriver _driver; + + [SetUp] + public void SetupTest() { - private IWebDriver _driver; + var driverOptions = new ChromeOptions(); - [SetUp] - public void SetupTest() - { - var driverOptions = new ChromeOptions(); + var runName = GetType().Assembly.GetName().Name; + var timestamp = $"{DateTime.Now:yyyyMMdd.HHmm}"; - var runName = GetType().Assembly.GetName().Name; - var timestamp = $"{DateTime.Now:yyyyMMdd.HHmm}"; + driverOptions.AddAdditionalOption("name", runName); + driverOptions.AddAdditionalOption("videoName", $"{runName}.{timestamp}.mp4"); + driverOptions.AddAdditionalOption("logName", $"{runName}.{timestamp}.log",); + driverOptions.AddAdditionalOption("enableVNC", true); + driverOptions.AddAdditionalOption("enableVideo", true); + driverOptions.AddAdditionalOption("enableLog", true); + driverOptions.AddAdditionalOption("screenResolution", "1920x1080x24"); - driverOptions.AddAdditionalCapability("name", runName, true); - driverOptions.AddAdditionalCapability("videoName", $"{runName}.{timestamp}.mp4", true); - driverOptions.AddAdditionalCapability("logName", $"{runName}.{timestamp}.log", true); - driverOptions.AddAdditionalCapability("enableVNC", true, true); - driverOptions.AddAdditionalCapability("enableVideo", true, true); - driverOptions.AddAdditionalCapability("enableLog", true, true); - driverOptions.AddAdditionalCapability("screenResolution", "1920x1080x24", true); + _driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), driverOptions); + _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30); + } - _driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), driverOptions); - _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30); - } + [TearDown] + public void TeardownTest() + { + _driver.Quit(); + } - [TearDown] - public void TeardownTest() + [Test] + public void FillAllTextFields() + { + string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; + _driver.Navigate().GoToUrl(testPagePath); + var textBoxes = _driver.FindElements(By.Name("fname")); + foreach (var textBox in textBoxes) { - _driver.Quit(); + textBox.SendKeys(Guid.NewGuid().ToString()); } + } - [Test] - public void FillAllTextFields() - { - string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; - _driver.Navigate().GoToUrl(testPagePath); - var textBoxes = _driver.FindElements(By.Name("fname")); - foreach (var textBox in textBoxes) - { - textBox.SendKeys(Guid.NewGuid().ToString()); - } - } + [Test] + public void FillAllSelects() + { + string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; + _driver.Navigate().GoToUrl(testPagePath); - [Test] - public void FillAllSelects() + var selects = _driver.FindElements(By.TagName("select")); + foreach (var select in selects) { - string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; - _driver.Navigate().GoToUrl(testPagePath); - - var selects = _driver.FindElements(By.TagName("select")); - foreach (var select in selects) - { - var selectElement = new SelectElement(select); - selectElement.SelectByText("Mercedes"); - } + var selectElement = new SelectElement(select); + selectElement.SelectByText("Mercedes"); } + } - [Test] - public void FillAllColors() + [Test] + public void FillAllColors() + { + string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; + _driver.Navigate().GoToUrl(testPagePath); + var colors = _driver.FindElements(By.XPath("//input[@type='color']")); + foreach (var color in colors) { - string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; - _driver.Navigate().GoToUrl(testPagePath); - var colors = _driver.FindElements(By.XPath("//input[@type='color']")); - foreach (var color in colors) - { - SetValueAttribute(_driver, color, "#000000"); - } + SetValueAttribute(_driver, color, "#000000"); } + } - [Test] - public void SetAllDates() + [Test] + public void SetAllDates() + { + string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; + _driver.Navigate().GoToUrl(testPagePath); + var dates = _driver.FindElements(By.XPath("//input[@type='date']")); + foreach (var date in dates) { - string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; - _driver.Navigate().GoToUrl(testPagePath); - var dates = _driver.FindElements(By.XPath("//input[@type='date']")); - foreach (var date in dates) - { - SetValueAttribute(_driver, date, "2020-06-01"); - } + SetValueAttribute(_driver, date, "2020-06-01"); } + } - [Test] - public void ClickAllRadioButtons() + [Test] + public void ClickAllRadioButtons() + { + string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; + _driver.Navigate().GoToUrl(testPagePath); + var radioButtons = _driver.FindElements(By.XPath("//input[@type='radio']")); + foreach (var radio in radioButtons) { - string testPagePath = "http://htmlpreview.github.io/?https://github.com/angelovstanton/AutomateThePlanet/blob/master/WebDriver-Series/TestPage.html"; - _driver.Navigate().GoToUrl(testPagePath); - var radioButtons = _driver.FindElements(By.XPath("//input[@type='radio']")); - foreach (var radio in radioButtons) - { - radio.Click(); - } + radio.Click(); } + } - private void SetValueAttribute(IWebDriver driver, IWebElement element, string value) - { - SetAttribute(driver, element, "value", value); - } + private void SetValueAttribute(IWebDriver driver, IWebElement element, string value) + { + SetAttribute(driver, element, "value", value); + } - private void SetAttribute(IWebDriver driver, IWebElement element, string attributeName, string attributeValue) - { - driver.ExecuteJavaScript - ( - "arguments[0].setAttribute(arguments[1], arguments[2]);", - element, - attributeName, - attributeValue); - } + private void SetAttribute(IWebDriver driver, IWebElement element, string attributeName, string attributeValue) + { + driver.ExecuteJavaScript + ( + "arguments[0].setAttribute(arguments[1], arguments[2]);", + element, + attributeName, + attributeValue); } } \ No newline at end of file diff --git a/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/WebDriverTestsDockerSelenoid.csproj b/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/WebDriverTestsDockerSelenoid.csproj index 59079e04..5f5d3bd8 100644 --- a/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/WebDriverTestsDockerSelenoid.csproj +++ b/dotnet/WebAutomation-Series/WebDriverTestsDockerSelenoid/WebDriverTestsDockerSelenoid.csproj @@ -2,14 +2,14 @@ - - - + + + - + - + all