Last active
April 26, 2023 07:04
Revisions
-
SarahElson renamed this gist
Apr 26, 2023 . 1 changed file with 0 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,6 @@ using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Remote; namespace SeleniumCSharp_BrowserCommands { public class BrowserCommandsTests @@ -13,7 +12,6 @@ public class BrowserCommandsTests private static readonly string LT_ACCESS_KEY = Environment.GetEnvironmentVariable("LT_ACCESS_KEY"); private static readonly string testUrl = "https://ecommerce-playground.lambdatest.io/"; [SetUp] public void Setup() { @@ -44,7 +42,6 @@ public void NavigateTest() Assert.That(cookie.Value.Equals("USD")); } [TearDown] public void TearDown() { -
SarahElson created this gist
Apr 26, 2023 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Remote; namespace SeleniumCSharp_BrowserCommands { public class BrowserCommandsTests { private static IWebDriver driver; private static readonly string gridURL = "@hub.lambdatest.com/wd/hub"; private static readonly string LT_USERNAME = Environment.GetEnvironmentVariable("LT_USERNAME"); private static readonly string LT_ACCESS_KEY = Environment.GetEnvironmentVariable("LT_ACCESS_KEY"); private static readonly string testUrl = "https://ecommerce-playground.lambdatest.io/"; [SetUp] public void Setup() { ChromeOptions capabilities = new ChromeOptions(); capabilities.BrowserVersion = "108.0"; Dictionary<string, object> ltOptions = new Dictionary<string, object>(); ltOptions.Add("username", LT_USERNAME); ltOptions.Add("accessKey", LT_ACCESS_KEY); ltOptions.Add("platformName", "Windows 11"); ltOptions.Add("project", "Selenium Scroll"); ltOptions.Add("w3c", true); ltOptions.Add("plugin", "c#-nunit"); capabilities.AddAdditionalOption("LT:Options", ltOptions); driver = new RemoteWebDriver(new Uri($"https://{LT_USERNAME}:{LT_ACCESS_KEY}{gridURL}"), capabilities); } [Test] public void NavigateTest() { driver.Navigate().GoToUrl(testUrl); driver.Manage().Window.Maximize(); driver.FindElement(By.PartialLinkText("Special")).Click(); Assert.That(driver.Title.Equals("Special Offers")); driver.Navigate().Back(); Assert.That(driver.Url.Equals(testUrl)); var cookie = driver.Manage().Cookies.GetCookieNamed("currency"); Assert.That(cookie.Value.Equals("USD")); } [TearDown] public void TearDown() { driver.Quit(); } } }