public NuGetFluentTest(ITestOutputHelper testOutputHelper) { _testOutputHelper = testOutputHelper; _clientSdkHelper = new ClientSdkHelper(testOutputHelper); SeleniumWebDriver.Bootstrap(); }
public void Search_FindResult_ResultPageIsShown() { // prepare stage // bootstrap webdriver SeleniumWebDriver.Bootstrap(new[] { SeleniumWebDriver.Browser.Chrome }); // navigate to amazon page I.Open("http://www.amazon.com"); // act stage // wait until page loaded I.WaitUntil(() => I.Expect.Exists("#twotabsearchtextbox")); // find search box element write down the text to search for and hit the enter key I.Enter("Emilian Balanescu").In("#twotabsearchtextbox"); // press enter to submit form I.Press("{ENTER}"); // assert stage // wait until results page loaded I.WaitUntil(() => I.Expect.Exists("#atfResults")); // read the heading of the first result and verify the value is as expected I.Assert .Text("Beginning PHP and PostgreSQL E-Commerce: From Novice to Professional (Beginning, from Novice to Professional)") .In("h2[data-attribute]:first-child"); }
public void BeforeScenario() { //ContextInfo.dbcontext = new NorthwindEntities(); SeleniumWebDriver.Bootstrap( SeleniumWebDriver.Browser.Firefox ); }
// Help method to wait for first option available public void WaitForFirstOptionAvailable() { var myWait = new WebDriverWait(SeleniumWebDriver, TimeSpan.FromSeconds(Timeout)); var id = SeleniumWebDriver.FindElement(Identifier).GetAttribute("id"); var childSelector = "#" + id + " > option:nth-child(2)"; myWait.Until(d => d.FindElement(By.CssSelector(childSelector))); }
static void Main(string[] args) { SeleniumWebDriver.Bootstrap(FluentAutomation.SeleniumWebDriver.Browser.Chrome); //PhantomJS.Bootstrap(); NodeService.Current.Start(); System.Console.ReadLine(); NodeService.Current.Stop(); }
public void Validate(SeleniumWebDriver selenium, string deviceAddress) { foreach (Control page in this.Controls) { if (page is PageViewer) { (page as PageViewer).Validate(selenium, deviceAddress); } } }
public void CustomBrowser(string browserName) { var driver = new SeleniumWebDriver(Browser.Parse(browserName)); using (var custom = new BrowserSession(driver)) { custom.Visit("https://saucelabs.com/test/guinea-pig"); Assert.That(custom.ExecuteScript("return 0;"), Is.EqualTo(0)); } }
public void AssertShouldFailTest() { SeleniumWebDriver.Bootstrap(Browser.Chrome, Browser.Firefox); Assert.Throws <FluentException>(() => { I.Open("http://google.com/") .Assert .Class("wowza").On("input[type='text']"); }); }
public void Validate(SeleniumWebDriver selenium, string deviceAddress) { TabPage page = _tabControl.SelectedTab; if (null != page) { if (page.Controls[0] is SiteMapViewer) { (page.Controls[0] as SiteMapViewer).Validate(selenium, deviceAddress); } } }
static void Main(string[] args) { SeleniumWebDriver seleniumWebDriver = new SeleniumWebDriver(new SeleniumSettings { IsDisableExtensions = false, IsHeadless = false, ProfileDirectory = "./ChromeDriver/Profile 2", UserDataDir = @"./ChromeDriver/" }); ISteam <SteamItem> steam = new Steam <SteamItem>(seleniumWebDriver); //SteamItem steamItem = new SteamItem(); //steam.GetByName("'The Doctor' Romanov | Sabre", steamItem); steam.GetSteamInventory("76561198875308001"); }
public BaseTest() { FluentSession.EnableStickySession(); Config.WaitUntilTimeout(TimeSpan.FromMilliseconds(1000)); // Create Page Objects HomePage = new Pages.HomePage(this); InputsPage = new Pages.InputsPage(this); AlertsPage = new Pages.AlertsPage(this); ScrollingPage = new Pages.ScrollingPage(this); TextPage = new Pages.TextPage(this); DragPage = new Pages.DragPage(this); SwitchPage = new Pages.SwitchPage(this); // Default tests use chrome and load the site SeleniumWebDriver.Bootstrap(Browser.Chrome);//, Browser.InternetExplorer, Browser.Firefox); I.Open(SiteUrl); }
public void TestMethod1() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome); FluentConfig.Current.MinimizeAllWindowsOnTestStart(true).WindowMaximized(true); var imageURL = "http://image.baidu.com"; I.Open(imageURL); I.WaitUntil(() => I.Assert.Exists("input#kw")); I.Enter("美女").In("input#kw").Click("input.s_btn"); I.WaitForAjaxFinish(); I.Click("div#userInfo>a:eq(0)").WaitForAjaxFinish(); int total = 0; for (int i = 0; i < 1; i++) { total = DownloadPic(total); I.Click("a.n:contains('下一页')").WaitForAjaxFinish(); } }
private (string session, string crsf_token) LoginUsingSelenium(SeleniumWebDriver seleniumWebDriver) { seleniumWebDriver.GoToUrl("https://powertofly.com/accounts/login"); //seleniumWebDriver.ChromeDriver.FindElementById("login-email").SendKeys(); // seleniumWebDriver.ChromeDriver.FindElementById("login-password").SendKeys(); seleniumWebDriver.ChromeDriver.FindElementById("login-button").Click(); var cookies = seleniumWebDriver.ChromeDriver.Manage().Cookies.AllCookies.ToDictionary(cookie => cookie.Name, cookie => cookie.Value); var session = cookies["session"]; var doc = new HtmlDocument(); doc.LoadHtml(seleniumWebDriver.ChromeDriver.PageSource); var attributes = doc.GetElementbyId("csrf_token").Attributes; var token = attributes.First(x => x.Name == "value").Value; return(session, token); }
private void Initilize() { this.FormClosing += new FormClosingEventHandler(MDIParent_FormClosing); _tabbedPanel = new TabbedPanel(siteMapsDetails_TabControl); _productExplorer = new ProductExplorer(productExplorer_TreeView, _tabbedPanel); // clear tab items _tabbedPanel.ClearTabs(); CopyExplorerDriverServer(); _selenium = new SeleniumWebDriver(BrowserModel.Firefox, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); this.Text += " " + Assembly.GetExecutingAssembly().GetName().Version + " beta"; FolderBrowserDialog fbd = new FolderBrowserDialog(); if (DialogResult.OK == fbd.ShowDialog()) { GlobalSettings.Items.Add("EwsSitemapLocation", fbd.SelectedPath); // set the version of the tool _productExplorer.LoadProducts(GlobalSettings.Items["EwsSitemapLocation"]); } }
private bool IsElementExists(SeleniumWebDriver selenium, string locator, FindType type) { if (string.IsNullOrWhiteSpace(locator)) { return(false); } try { IWebElement element = selenium.FindElement(locator, type, retry: false); if (null == element) { return(false); } return(true); } catch { return(false); } }
// Retrieve value of selected text public string GetSelectedOptionText() { var selectElement = new SelectElement(SeleniumWebDriver.FindElement(Identifier)); return(selectElement.SelectedOption.Text); }
// Select option by option's position public void SelectByIndex(int index) { var selectElement = new SelectElement(SeleniumWebDriver.FindElement(Identifier)); selectElement.SelectByIndex(index); }
// Select option by option's text public void SelectByText(string text) { var selectElement = new SelectElement(SeleniumWebDriver.FindElement(Identifier)); selectElement.SelectByText(text); }
public static void BeforeFeature() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome); }
public static void StartBrowser() { var browsers = new[] { SeleniumWebDriver.Browser.Chrome }; SeleniumWebDriver.Bootstrap(browsers); }
public Steam(SeleniumWebDriver seleniumWebDriver) { this.seleniumWebDriver = seleniumWebDriver; }
// Click the button public void Click() { SeleniumWebDriver.FindElement(Identifier).Click(); }
public void SignInTestsInitialize() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome); FluentAutomation.FluentSettings.Current.WaitOnAllActions = false; }
public void BeforeScenario() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome); }
public void Arrange() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.PhantomJs); }
public FluentAct() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.PhantomJs); }
public void TestInitialize() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome, TimeSpan.FromSeconds(15)); LoadBetterNetExtension(); }
public PageBase() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome); this.FluentTest = new FluentTest(); this.I = this.FluentTest.I; }
public static void SetBrowser() { SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome); }
public WithPageObjectTests() { SeleniumWebDriver .Bootstrap(SeleniumWebDriver.Browser.InternetExplorer); }