public void Session_exposes_native_driver_if_you_really_need_it() { using (var browserSession = new BrowserSession(SessionConfiguration)) { Assert.That(browserSession.Native, Is.EqualTo("Native driver on fake driver")); } }
public void Dispose_handles_a_disposed_session() { var browserSession = new BrowserSession(SessionConfiguration); browserSession.Dispose(); browserSession.Dispose(); }
public void SetUpFixture() { SessionConfiguration = new SessionConfiguration(); SessionConfiguration.Timeout = TimeSpan.FromMilliseconds(1000); browser = new BrowserSession(SessionConfiguration); browser.Visit("file:///" + new FileInfo(@"html\table.htm").FullName.Replace("\\", "/")); }
private async void LogInClicked(object sender, EventArgs e) { BeginBusy("Loading..."); try { session = new BrowserSession(); Status("Loading home page..."); var homePage = await session.Get<HomePage>("http://www.truelocal.com.au/"); Status("Logging in..."); var accountPage = await homePage.LogIn(usernameText.Text, passwordText.Text); Status("Fetching business listings..."); var listingsPage = await accountPage.GoToListings(); foreach (var listing in listingsPage.Listings) { Status("Getting listing " + listing.BusinessName + "..."); await listingsPage.LoadListingDetails(listing); } mobilePhone.Text = listingsPage.Listings.First().MobilePhoneNumber; } finally { EndBusy(); } }
private void LoadGamesPerDivision(BrowserSession b, KeyValuePair<long, string> page) { try { var teams = GetTeams(1, page.Key); int take = 1; take = take + teams.Count / 2; if (teams.Count % 2 > 0) take++; var doc = b.GetDoc(page.Value); //Table => Games table var table = doc.DocumentNode.Descendants("table") .FirstOrDefault( t => t.Attributes.Contains("class") && t.Attributes["class"].Value.Contains("clubentrees")); if (table != null) { using (var context = new ScoresEntities()) { int skip = 1; var rows = table.Descendants("tr").Skip(skip).Take(take).ToList(); while (rows.Any()) { var dateRow = rows[0]; DateTime? date = ProcessDateRow(dateRow); if (date.HasValue) { foreach (var row in rows.Skip(1)) { Trace.WriteLine(row.InnerText); games game = ProcessGameRow(row, date.Value, teams, context, page); if (game != null && game.GameId <= 0) context.games.Add(game); } } Trace.WriteLine("----------"); skip = skip + take + 1; rows = table.Descendants("tr").Skip(skip).Take(take + 1).ToList(); } context.SaveChanges(); } } else Trace.WriteLine("---WRONG---"); } catch (Exception ex) { Trace.WriteLine(string.Format("There was an error fetching division {0}", page.Key)); throw; } }
public void SetUp() { stubUrlBuilder = new StubUrlBuilder(); _stubRestrictedResourceDownloader = new SpyRestrictedResourceDownloader(); driver = new FakeDriver(); SessionConfiguration = new SessionConfiguration(); browserSession = TestSessionBuilder.Build(SessionConfiguration, driver, new SpyTimingStrategy(), new FakeWaiter(), _stubRestrictedResourceDownloader, stubUrlBuilder); }
public void SetUp() { stubUrlBuilder = new StubUrlBuilder(); _stubRestrictedResourceDownloader = new SpyRestrictedResourceDownloader(); driver = new FakeDriver(); configuration = new Configuration(); browserSession = TestSessionBuilder.Build(configuration, driver, new SpyRobustWrapper(), new FakeWaiter(), _stubRestrictedResourceDownloader, stubUrlBuilder); }
public void SetUpFixture() { var configuration = new SessionConfiguration { Timeout = TimeSpan.FromMilliseconds(2000), Browser = Drivers.Browser.Firefox }; browser = new BrowserSession(configuration); }
public void SetUp() { SessionConfiguration = new SessionConfiguration(); SessionConfiguration.AppHost = "www.google.com"; SessionConfiguration.Driver = typeof(SeleniumWebDriver); SessionConfiguration.Timeout = TimeSpan.FromSeconds(10); browser = new BrowserSession(SessionConfiguration); }
public void SetUp() { site = new SelfishSite(); var sessionConfiguration = new SessionConfiguration(); sessionConfiguration.Timeout = TimeSpan.FromMilliseconds(1000); sessionConfiguration.Port = site.BaseUri.Port; browser = new BrowserSession(sessionConfiguration); browser.Visit("/"); }
public void SetUp() { sinatraSite = new SinatraSite(string.Format(@"sites\{0}.rb", "site_with_secure_resources")); SessionConfiguration SessionConfiguration = new SessionConfiguration(); SessionConfiguration.Timeout = TimeSpan.FromMilliseconds(1000); SessionConfiguration.Port = 4567; browser = new BrowserSession(SessionConfiguration); browser.Visit("/"); }
public void AppHostContainsScheme() { SessionConfiguration = new SessionConfiguration(); SessionConfiguration.AppHost = "https://www.google.co.uk/"; SessionConfiguration.Driver = typeof(SeleniumWebDriver); browser = new BrowserSession(SessionConfiguration); browser.Visit("/"); Assert.That(browser.Location.ToString(), Is.EqualTo("https://www.google.co.uk/")); }
public void SetUpFixture() { var configuration = new SessionConfiguration { Timeout = TimeSpan.FromMilliseconds(2000), Driver = typeof(SeleniumWebDriver), Browser = Browser.Chrome }; browser = new BrowserSession(configuration); }
public void A_session_gets_its_driver_from_config() { SessionConfiguration.Driver = typeof (FakeDriver); using (var browserSession = new BrowserSession(SessionConfiguration)) { Assert.That(browserSession.Driver, Is.TypeOf(typeof(FakeDriver))); } SessionConfiguration.Driver = typeof(StubDriver); using (var browserSession = new BrowserSession(SessionConfiguration)) { Assert.That(browserSession.Driver, Is.TypeOf(typeof(StubDriver))); } }
public void Modal_dialog() { using (var session = new BrowserSession(new SessionConfiguration{Browser = Browser.Firefox})) { VisitTestPage(session); var linkId = session.FindLink("Open modal dialog").Id; session.ExecuteScript( string.Format("window.setTimeout(function() {{document.getElementById('{0}').click()}},1);", linkId)); var dialog = session.FindWindow("Pop Up Window"); dialog.FillIn("text input in popup").With("I'm interacting with a modal dialog"); dialog.ClickButton("close"); } }
public Fetcher() { pages = new Dictionary<long, string> { {1, "http://www.rugby.be/new/competition.cfm?div_id=10113"}, {2, "http://www.rugby.be/new/competition.cfm?div_id=10122"}, {3, "http://www.rugby.be/new/competition.cfm?div_id=10133"}, {4, "http://www.rugby.be/new/competition.cfm?div_id=10142"}, {5, "http://www.rugby.be/new/competition.cfm?div_id=10157"}, {6, "http://www.rugby.be/new/competition.cfm?div_id=10114"} }; browserSession = new BrowserSession(); //Force a first load to the correct season, calls after this will go to the correct page browserSession.GetDoc("http://www.rugby.be/new/competition.cfm?p_year=12"); }
public void HtmlUnitDriver() { SessionConfiguration.AppHost = "www.google.com"; SessionConfiguration.Browser = Drivers.Browser.HtmlUnit; try { using (var htmlUnit = new BrowserSession(SessionConfiguration)) { htmlUnit.Visit("/"); } Assert.Fail("Expected an exception attempting to connect to HtmlUnit driver"); } catch (WebDriverException e) { Assert.That(e.Message, Is.StringContaining("No connection could be made because the target machine actively refused it 127.0.0.1:4444")); } }
public void Two_browser_sessions_can_be_controlled_independently() { using (var sessionOne = new BrowserSession()) { using (var sessionTwo = new BrowserSession()) { VisitTestPage(sessionOne); VisitTestPage(sessionTwo); sessionOne.FillIn(sessionOne.FindCss("input[type=text]")).With("from session one"); sessionTwo.FillIn(sessionTwo.FindCss("input[type=text]")).With("from session two"); Assert.That(sessionOne.FindCss("input[type=text]").Value, Is.EqualTo("from session one")); Assert.That(sessionTwo.FindCss("input[type=text]").Value, Is.EqualTo("from session two")); } } }
public static void Process() { var b = new BrowserSession(); b.Get("https://secure.ngx.com/ngxcs/indexPrice/scrape.html"); b.FormElements["username"] = "******"; b.FormElements["password"] = "******"; string response = b.Post("https://secure.ngx.com/sso/login?service=https%3A%2F%2Fsecure.ngx.com%3A443%2Fngxcs%2Fj_spring_cas_security_check"); var doc = new HtmlDocument(); doc.LoadHtml(response); var db = new TBSPEntities1(); var gasIndexes = GetGasIndexFromResult(doc, "Union Dawn"); if (gasIndexes != null && gasIndexes.Any()) db.TMXGasIndexes.AddRange(gasIndexes); db.SaveChanges(); }
public CreateOrganization(BrowserSession browser) { this.browser = browser; }
public Engineering(BrowserSession browser) { this.browser = browser; }
public MySecondPageObject(BrowserSession session) : base(session) { }
public SendMailToAllSteps(BrowserSession browser, SimpleSmtpServer smtpServer, MailerDbEntities db) { _browser = browser; _smtpServer = smtpServer; _db = db; }
public swIdeaListMaster(BrowserSession currentBrowser) : base(currentBrowser) { }
private void VisitTestPage(BrowserSession browserSession) { browserSession.Visit("file:///" + new FileInfo(@"html\InteractionTestsPage.htm").FullName.Replace("\\", "/")); }
public GetGolfClubUserListSteps(TestingContext testingContext, BrowserSession browserSession) { this.TestingContext = testingContext; this.BrowserSession = browserSession; }
void IPage.Load(BrowserSession browser, HtmlDocument document) { Browser = browser; Interpret(document); }
public Scrapper(BrowserSession browserSession) { _browserSession = browserSession; _browserSession.Get("https://www.transavia.com/fr-FR/accueil"); TryExtractToken(); }
public imPublishedIdeaEmail(BrowserSession currentBrowser) : base(currentBrowser) { }
public TeamFetcher() { browserSession = new BrowserSession(); }
public void ThenIShouldSeeAMap() { Assert.True(BrowserSession.FindId("map").Exists()); }
public static ElementScope SearchButtonUpper(this BrowserSession browserSession) { return(browserSession.FindXPath("//*[@id='upperSearchArea']/div/table/tbody/tr/td[2]/button")); }
public ScoreFetcher() { browserSession = new BrowserSession(); //Force a first load to the correct season, calls after this will go to the correct page }
public BasicCoypuSteps(BrowserSession browser) { _browser = browser; }
public Link(ElementAttribute attribute, BrowserSession browser, Options findOptions, Coypu.Element element = null) : base(attribute, browser, findOptions, element) { }
public void SetUpFixture() { var configuration = new SessionConfiguration { Timeout = TimeSpan.FromMilliseconds(2000), Driver = Type.GetType("Coypu.Drivers.Selenium.SeleniumWebDriver, Coypu"), Browser = Drivers.Browser.Firefox }; browser = new BrowserSession(configuration); }
public void WhenIClickTheLink(string url) { BrowserSession.ClickLink(url); Thread.Sleep(1000); }
public SignUpUsername(BrowserSession browser) { this.browser = browser; }
public BeSocial(BrowserSession browser) { this.browser = browser; }
public PublishedIdeasAssertions(BrowserSession browser, swPublishedIdeas publishedIdeas) : base(browser) { this.publishedIdeas = publishedIdeas; }
public Main(BrowserSession browser) { _browser = browser; }
public Showcases(BrowserSession browser) { this.browser = browser; }
public static ElementScope SearchButtonReset(this BrowserSession browserSession) { return(browserSession.FindXPath("//*[@id='fullContainer']/fieldset[2]/div/a")); }
public void ThenIShouldNotSeeAButton(string buttonText) { Assert.False(BrowserSession.FindButton(buttonText).Exists()); }
public void SetUpFixture() { SessionConfiguration = new SessionConfiguration(); SessionConfiguration.Timeout = TimeSpan.FromMilliseconds(1000); browser = new BrowserSession(SessionConfiguration); }
public static ElementScope SearchTextBox(this BrowserSession browserSession) { return(browserSession.FindXPath("//*[@id='SearchString']")); }
public void CustomBrowserSession(string platform, string browserName, string version) { var desiredCapabilites = new DesiredCapabilities(browserName, version, Platform.CurrentPlatform); desiredCapabilites.SetCapability("platform", platform); desiredCapabilites.SetCapability("username", "appiumci"); desiredCapabilites.SetCapability("accessKey", "af4fbd21-6aee-4a01-857f-c7ffba2f0a50"); desiredCapabilites.SetCapability("name", TestContext.CurrentContext.Test.Name); Driver driver = new CustomDriver(Browser.Parse(browserName), desiredCapabilites); using (var custom = new BrowserSession(driver)) { custom.Visit("https://saucelabs.com/test/guinea-pig"); Assert.That(custom.ExecuteScript("return 0;"), Is.EqualTo("0")); } }
public static ElementScope TabSearch(this BrowserSession browserSession) { return(browserSession.FindXPath("//*[@id='menuContainer']/ul/li[1]/a")); }
public void CustomProfile() { var configuration = new SessionConfiguration {Driver = typeof (CustomFirefoxProfileSeleniumWebDriver)}; using (var custom = new BrowserSession(configuration)) { custom.Visit("https://www.relishapp.com/"); Assert.That(custom.ExecuteScript("return 0;"), Is.EqualTo("0")); } }
public RegistrationSteps(TestingContext testingContext, BrowserSession browserSession) { this.TestingContext = testingContext; this.BrowserSession = browserSession; }