internal static IDriverService StartService(WebDriver wd) { ExtendCapabilities(wd, false); FirefoxService svc = new FirefoxService(); svc.Start(wd.Arguments, wd.Preferences, wd.Extensions, wd.Capabilities, wd.Profile, wd.Persistant); return svc; }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { Capabilities capa = wd.Capabilities; Dictionary opts; if (!capa.TryGetValue("chromeOptions", out opts)) capa["chromeOptions"] = opts = new Dictionary(); capa.TryMove("debuggerAddress", opts); if (wd.Profile != null) wd.Arguments.Add("user-data-dir=" + ExpandProfile(wd.Profile, remote)); if (wd.Arguments.Count != 0) opts["args"] = wd.Arguments; if (wd.Extensions.Count != 0) opts["extensions"] = wd.Extensions; if (wd.Preferences.Count != 0) opts["prefs"] = wd.Preferences; if (wd.Binary != null) opts["binary"] = wd.Binary; capa.SetDefault("download.directory_upgrade", true); capa.SetDefault("download.prompt_for_download", false); }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { Capabilities capa = wd.Capabilities; Dictionary opts; if (!capa.TryGetValue("edgeOptions", out opts)) capa["edgeOptions"] = opts = new Dictionary(); }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { var capa = wd.Capabilities; capa["silent"] = true; capa["nativeEvents"] = true; //capa["requireWindowFocus"] = true; if (wd.Arguments.Count > 0) capa["ie.browserCommandLineSwitches"] = wd.Arguments; }
internal static IDriverService StartService(WebDriver wd) { ExtendCapabilities(wd, false); var svc = new DriverService(); svc.AddArgument("--port=" + svc.IPEndPoint.Port.ToString()); svc.AddArgument("--silent"); svc.Start("chromedriver.exe"); return svc; }
internal static IDriverService StartService(WebDriver wd) { ExtendCapabilities(wd, false); var svc = new DriverService(); svc.AddArgument("--webdriver=" + svc.IPEndPoint.ToString()); svc.AddArgument("--webdriver-loglevel=ERROR"); svc.AddArgument("--ignore-ssl-errors=true"); svc.Start("phantomjs.exe"); return svc; }
internal static IDriverService StartService(WebDriver wd) { ExtendCapabilities(wd, false); var svc = new DriverService(IPAddress.Loopback); svc.AddArgument("/host=" + svc.IPEndPoint.Address.ToString()); svc.AddArgument("/port=" + svc.IPEndPoint.Port.ToString()); svc.AddArgument("/log-level=ERROR"); svc.AddArgument("/silent"); svc.Start("iedriver.exe", true); return svc; }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { var capa = wd.Capabilities; capa["webdriver.logging.profiler.enabled"] = false; capa["loggingPrefs"] = new Dictionary { {"profiler", "OFF"}, {"driver", "OFF"}, {"browser", "OFF"} }; if (wd.Binary != null) capa["firefox_binary"] = wd.Binary; }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { var capa = wd.Capabilities; capa["silent"] = true; capa["nativeEvents"] = true; capa["initialBrowserUrl"] = "about:blank"; //capa["ignoreProtectedModeSettings"] = true; //capa["requireWindowFocus"] = true; if (wd.Arguments.Count > 0) { StringBuilder cmd_args = new StringBuilder(); foreach (string arg in wd.Arguments) cmd_args.Append(arg).Append(' '); capa["ie.browserCommandLineSwitches"] = cmd_args.ToString(); capa["ie.forceCreateProcessApi"] = true; } }
internal static IDriverService StartService(WebDriver wd) { ExtendCapabilities(wd, false); var svc = new DriverService(); svc.AddArgument("/host=" + svc.IPEndPoint.Address.ToString()); svc.AddArgument("/port=" + svc.IPEndPoint.Port.ToString()); svc.AddArgument("/log-level=ERROR"); svc.AddArgument("/silent"); string serverName; if (wd.Capabilities.TryGetValue("ie.serverBinary", out serverName)) { wd.Capabilities.Remove("ie.serverBinary"); } else { serverName = "iedriver.exe"; } svc.Start(serverName, true); return svc; }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { Capabilities capa = wd.Capabilities; Dictionary opts; if (!capa.TryGetValue("chromeOptions", out opts)) capa["chromeOptions"] = opts = new Dictionary(); capa.TryMove("debuggerAddress", opts); if (wd.Profile != null) wd.Arguments.Add("user-data-dir=" + ExpandProfile(wd.Profile, remote)); if (wd.Arguments.Count != 0) opts.Add("args", wd.Arguments); if (wd.Extensions.Count != 0) opts.Add("extensions", wd.Extensions); if (wd.Preferences.Count != 0) opts.Add("prefs", wd.Preferences); if (wd.Binary != null) opts.Add("binary", wd.Binary); }
public Browser GetBrowser(Uri uri) { return _webDriver ?? (_webDriver = (WebDriver) CreateBrowser(uri)); }
public void MoodleAssistant_UploadXML_NonCSVFile_DisplaysAlert() { UploadCorrectXMlFile(); UploadCsvFile("txtFile.txt"); Assert.True(WebDriver.FindElement(By.ClassName(Error.NonCsvFile.ToString())).Displayed); }
public void MoodleAssistant_UploadCSV_EmptyCSV_DisplaysAlert() { UploadCorrectXMlFile(); UploadCsvFile("EmptyCsv.csv"); Assert.True(WebDriver.FindElement(By.ClassName(Error.EmptyFile.ToString())).Displayed); }
internal static void ExtendCapabilities(WebDriver wd, bool remote) { var capa = wd.Capabilities; capa.BrowserName = "phantomjs"; if (wd.Arguments.Count > 0) capa["phantomjs.cli.args"] = wd.Arguments; }
public HomePage(WebDriver driver) : base(driver) { }
public TutorialNavigator(WebDriver driver, ILogger logger, EnvironmentConfig appConfiguration) : base(driver, logger) { _appConfiguration = appConfiguration; }
private void UploadCorrectXMlFile() { WebDriver.Url = SiteUrl + "Xml/Upload"; UploadXmlFile("MoodleQuestionOk.xml"); WebDriver.FindElement(By.Id("upload-csv")).Click(); }
public MultiSelectionOption(IDriver driver, IElement el) : base(el) { this.driver = (WebDriver)driver; }
public WebSteps(WebDriver webDriver) { _webDriver = webDriver; }
public BaseBrowsers(Browser browser) { WebServer.StartServer(@"..\..\Pages"); this.driver = GetBrowserInstance(browser); this.driver.BaseUrl = WebServer.BaseUri; this.Fixture = browser; }
public static void VerifyRegistrationUploadPage() { Assert.AreEqual(UploadRegistrationUrl, WebDriver.Url); Assert.AreEqual(Constants.UploadRegPageTitle, WebDriver.Title); Assert.AreEqual(Constants.UploadRegPageHeader, WebDriver.FindElement(PageHeader).Text); }
public static void VerifyRegistrationDashboardPage() { Assert.AreEqual(RestrationUrl, WebDriver.Url); Assert.AreEqual(Constants.RegistrationsPageTitle, WebDriver.Title); Assert.AreEqual(Constants.RegistationPageHeader, WebDriver.FindElement(PageHeader).Text); }
public void GivenIClickOnTheSignOutLink() { WebDriver.FindElement(TlevelDashboardPage.SignOutLink).Click(); }
public void CloseBrowser() { if (_webDriver == null) return; _webDriver.Close(); _webDriver = null; }
public static void CodeTransmit_Action_Connect(Case.BasicTestCase refTestCase, WebDriver.WebBrowserDriver refWebBrowserDriver, CodeLine activeSelectLine) { if (activeSelectLine.KeyCode == Container.KeyWordMap.Connect) { try { foreach (string paramName in activeSelectLine.ParamsPool.Keys) { if (paramName == "type") { switch (activeSelectLine.ParamsPool[paramName]) { case "Chrome": case "chrome": case "CHROME": default: refWebBrowserDriver = WebDriver.WebBrowserDriver.CreateInstanceForWebDriver(WebDriver.WebBrowserType.Chrome); break; case "IE": case "ie": refWebBrowserDriver = WebDriver.WebBrowserDriver.CreateInstanceForWebDriver(WebDriver.WebBrowserType.InternetExplorer); break; case "firefox": case "Firefox": refWebBrowserDriver = WebDriver.WebBrowserDriver.CreateInstanceForWebDriver(WebDriver.WebBrowserType.FireFox); break; } } } refTestCase.ActionWebBrowserActionsObject = new WebDriver.WebBrowserActions(refWebBrowserDriver.ActiveWebDriver); refTestCase.ActiveWebBrowserDriverObject = refWebBrowserDriver; refTestCase.ActiveElementSelectorObject = new ElementActions.ElementSelector(refWebBrowserDriver.ActiveWebDriver); } catch (Exception err) { refTestCase.SingleInterrupt = true; refTestCase.ActiveTestCaseReport.InsertFaildItem(activeSelectLine.CodeIndex, "Fail to transmit : Connect : " + err.Message, true); } } }
public void MoodleAssistant_UploadCSV_CSVWithSemicolonSeparator_DisplaysAlert() { UploadCorrectXMlFile(); UploadCsvFile("CsvWithSemiColonSeparator.csv"); Assert.True(WebDriver.FindElement(By.ClassName(Error.CsvInvalidHeader.ToString())).Displayed); }
public BlogPostSection(WebDriver driver, ILogger logger, IFeedFactory feedFactory) : base(driver, logger) { _feedFactory = feedFactory; }
public void MoodleAssistant_UploadCSV_CSVBadFormed_DisplaysAlert(string filename) { UploadCorrectXMlFile(); UploadCsvFile(filename); Assert.True(WebDriver.FindElement(By.ClassName(Error.CsvBadFormed.ToString())).Displayed); }
public static new void ClickButton(By locator) { WebDriver.FindElement((locator)).Click(); }
private async void Button_Click_3(object sender, RoutedEventArgs e) { if (webDriver == null) { asyncChromeDriver = new AsyncChromeDriver(); webDriver = new WebDriver(asyncChromeDriver); } try { await webDriver.Options().Timeouts.SetImplicitWait(TimeSpan.FromSeconds(3)); // name = "q", 0 - time to wait element, not use ImplicitWait var prevQuery = await webDriver.FindElementByNameOrDefault("q", 0); var res2 = await webDriver.GoToUrl("https://www.google.com/"); //var query = await webDriver.FindElementByName("q", prevQuery?.Id); var query = await webDriver.FindElementById("lst-ib", prevQuery?.Id); //await query.SendKeys("ToCSharp"); var rnd = new Random(); foreach (var v in "ToCSharp") { await Task.Delay(500 + rnd.Next(1000)); await query.SendKeys(v.ToString()); } await Task.Delay(500); prevQuery = await webDriver.FindElementByName("q"); await query.SendKeys(Keys.Enter); query = await webDriver.FindElementByName("q", prevQuery?.Id); await query.SendKeys(Keys.ArrowDown); await Task.Delay(1000); await query.SendKeys(Keys.ArrowDown); await Task.Delay(2000); await query.SendKeys(Keys.ArrowDown); await Task.Delay(1000); await query.SendKeys(Keys.ArrowUp); await Task.Delay(500); await query.SendKeys(Keys.Enter); var el = await webDriver.SwitchTo().ActiveElement(); await webDriver.Keyboard.SendKeys(Keys.PageDown); var allCookies = await asyncChromeDriver.DevTools.Network.GetAllCookies(); var screenshot = await asyncChromeDriver.DevTools.Page.CaptureScreenshot(); if (!string.IsNullOrWhiteSpace(screenshot.Data)) { var dir = @"C:\temp"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var i = 0; var path = ""; do { i++; path = Path.Combine(dir, $"screenshot{i}.png"); } while (File.Exists(path)); File.WriteAllBytes(path, Convert.FromBase64String(screenshot.Data)); } } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); } }