public void SelectNugetPackage(string packageName, string version) { _driver.Type(NugetPackageInput, packageName); _driver.WaitForElementVisible(NugetPackagesListItems); _driver.ClickAllVisible(NugetSpecificPackage(packageName)); _driver.WaitForTextNotVisible(VersionsLoading); if (_driver.BrowserName() != CommonConstants.Chrome) { _driver.FindElementVisible(NugetSpecificPackage(packageName)).SendKeys(Keys.Space); _driver.SendKeyBoardKey(Keys.ArrowDown); _driver.WaitForTextNotVisible(VersionsLoading); } _driver.WaitFor(0.5); if (!string.IsNullOrEmpty(version)) { if (!_driver.IsElementVisible(NugetPackageVersion(version))) { _driver.ClickAllVisible(NugetSpecificPackage(packageName)); _driver.WaitForTextNotVisible(VersionsLoading); _driver.WaitFor(0.5); } _driver.MoveToElement(NugetPackageVersion(version)); _driver.Click(NugetPackageVersion(version)); } _driver.WaitForElementVisible(SelectedNugetPackage, 5); }
public void BeforeScenario(ScenarioContext scenarioContext) { _driver = new Driver(); Random rnd = new Random(); _driver.StartBrowser(rnd.Next(1, 3) < 2 ? CommonConstants.Chrome : CommonConstants.Firefox, path: Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + "\\Drivers"); _browser = _driver.BrowserName(); _driver.Navigate(CommonConstants.DotnetFiddleWebsiteUrl); scenarioContext.Add("driver", _driver); var scenarioName = TestContext.CurrentContext.Test.Name.Split('(').FirstOrDefault(); var f = TestContext.CurrentContext.Test.Name.Split('(').LastOrDefault().Trim(')').Split(','); scenarioName = scenarioName + ": Given First name =>" + f[1] + " AND Expected Output text => " + f[0] + " Browser =>" + _browser; _scenarioTestReport = _featureTestReport.CreateNode <Scenario>(scenarioName); }