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();
        }
Пример #3
0
 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("\\", "/"));
 }
Пример #4
0
        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();
            }
        }
Пример #5
0
        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);
        }
Пример #8
0
 public void SetUpFixture()
 {
     var configuration = new SessionConfiguration
         {
             Timeout = TimeSpan.FromMilliseconds(2000),
             Browser = Drivers.Browser.Firefox
         };
     browser = new BrowserSession(configuration);
 }
Пример #9
0
        public void SetUp()
        {
            SessionConfiguration = new SessionConfiguration();
            SessionConfiguration.AppHost = "www.google.com";
            SessionConfiguration.Driver = typeof(SeleniumWebDriver);

            SessionConfiguration.Timeout = TimeSpan.FromSeconds(10);

            browser = new BrowserSession(SessionConfiguration);
        }
Пример #10
0
        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("/");
        }
Пример #11
0
        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("/");
        }
Пример #12
0
        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/"));
        }
Пример #13
0
        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)));
            }
        }
Пример #15
0
        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");
            }
        }
Пример #16
0
        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");
        }
Пример #17
0
        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"));
            }
        }
Пример #18
0
        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"));
                }
            }
        }
Пример #19
0
        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();
        }
Пример #20
0
 public CreateOrganization(BrowserSession browser)
 {
     this.browser = browser;
 }
Пример #21
0
 public Engineering(BrowserSession browser)
 {
     this.browser = browser;
 }
Пример #22
0
 public MySecondPageObject(BrowserSession session) : base(session)
 {
 }
Пример #23
0
 public SendMailToAllSteps(BrowserSession browser, SimpleSmtpServer smtpServer, MailerDbEntities db)
 {
     _browser    = browser;
     _smtpServer = smtpServer;
     _db         = db;
 }
Пример #24
0
 public swIdeaListMaster(BrowserSession currentBrowser)
     : base(currentBrowser)
 {
 }
Пример #25
0
 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;
 }
Пример #27
0
 void IPage.Load(BrowserSession browser, HtmlDocument document)
 {
     Browser = browser;
     Interpret(document);
 }
Пример #28
0
 public Scrapper(BrowserSession browserSession)
 {
     _browserSession = browserSession;
     _browserSession.Get("https://www.transavia.com/fr-FR/accueil");
     TryExtractToken();
 }
Пример #29
0
 public imPublishedIdeaEmail(BrowserSession currentBrowser)
     : base(currentBrowser)
 {
 }
Пример #30
0
 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"));
 }
Пример #33
0
 public ScoreFetcher()
 {
     browserSession = new BrowserSession();
     //Force a first load to the correct season, calls after this will go to the correct page
 }
Пример #34
0
 public BasicCoypuSteps(BrowserSession browser)
 {
     _browser = browser;
 }
Пример #35
0
 public Link(ElementAttribute attribute, BrowserSession browser, Options findOptions, Coypu.Element element = null) : base(attribute, browser, findOptions, element)
 {
 }
Пример #36
0
 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);
 }
Пример #37
0
 public void WhenIClickTheLink(string url)
 {
     BrowserSession.ClickLink(url);
     Thread.Sleep(1000);
 }
Пример #38
0
 public SignUpUsername(BrowserSession browser)
 {
     this.browser = browser;
 }
Пример #39
0
 public BeSocial(BrowserSession browser)
 {
     this.browser = browser;
 }
Пример #40
0
 public PublishedIdeasAssertions(BrowserSession browser, swPublishedIdeas publishedIdeas) : base(browser)
 {
     this.publishedIdeas = publishedIdeas;
 }
Пример #41
0
 public Main(BrowserSession browser)
 {
     _browser = browser;
 }
Пример #42
0
 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());
 }
Пример #45
0
 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']"));
 }
Пример #47
0
        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"));
 }
Пример #49
0
        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;
 }