示例#1
0
 /// <summary>
 /// A new browser session. Control the lifecycle of this session with using{} / session.Dispose()
 /// </summary>
 /// <param name="SessionConfigurationconfiguration for this session</param>
 /// <returns>The new session</returns>
 public BrowserSession(SessionConfiguration SessionConfiguration)
     : this(new ActivatorDriverFactory(),
            SessionConfiguration,
            new RetryUntilTimeoutRobustWrapper(),
            new StopwatchWaiter(),
            new WebClientWithCookies(),
            new FullyQualifiedUrlBuilder())
 {
 }
        public string GetFullyQualifiedUrl(string virtualPath, SessionConfiguration sessionConfiguration)
        {
            var scheme = sessionConfiguration.SSL ? "https" : "http";
            var baseUrl = sessionConfiguration.Port == 80
                ? String.Format("{0}://{1}", scheme, sessionConfiguration.AppHost)
                : String.Format("{0}://{1}:{2}", scheme, sessionConfiguration.AppHost, sessionConfiguration.Port);

            return new Uri(new Uri(baseUrl), virtualPath).AbsoluteUri;
        }
示例#3
0
 public void Setup()
 {
     config = new SessionConfiguration
     {
         AppHost = "coypuspc.azurewebsites.net",
         Browser = Browser.Firefox
     };
     browser = new BrowserSession(config);
 }
        public string GetFullyQualifiedUrl(string virtualPath, SessionConfiguration sessionConfiguration)
        {
            var scheme = sessionConfiguration.SSL ? "https" : "http";
            var userInfoPart = string.IsNullOrEmpty(sessionConfiguration.UserInfo) ? "" : sessionConfiguration.UserInfo + "@";
            var baseUrl = sessionConfiguration.Port == 80
                ? String.Format("{0}://{1}{2}", scheme, userInfoPart, sessionConfiguration.AppHost)
                : String.Format("{0}://{1}{2}:{3}", scheme, userInfoPart, sessionConfiguration.AppHost, sessionConfiguration.Port);

            return new Uri(new Uri(baseUrl), virtualPath).AbsoluteUri;
        }
示例#5
0
 /// <summary>
 /// A new browser session. Control the lifecycle of this session with using{} / session.Dispose()
 /// </summary>
 /// <param name="SessionConfigurationconfiguration for this session</param>
 /// <returns>The new session</returns>
 public BrowserSession(SessionConfiguration SessionConfiguration)
     : this(new ActivatorDriverFactory(),
            SessionConfiguration,
            new RetryUntilTimeoutTimingStrategy(),
            new StopwatchWaiter(),
            new WebClientWithCookies(),
            new FullyQualifiedUrlBuilder(),
            new FinderOptionsDisambiguationStrategy())
 {
 }
        public static SessionConfiguration GetSeesionDetails()
        {
            SessionConfiguration config = new SessionConfiguration();
            config.AppHost = "localhost:56731";
            config.Port = Int32.Parse("101");
            config.Driver = typeof(Coypu.Drivers.Selenium.SeleniumWebDriver);
            config.Browser = Coypu.Drivers.Browser.InternetExplorer;

            return config;
        }
示例#7
0
 public void CheckSimplePageLoad()
 {
     var sessionConfiguration = new SessionConfiguration
                                	{
                                		AppHost = "teamaton.com",
                                		Browser = Browser.HtmlUnitWithJavaScript,
                                	};
     var browserSession = new BrowserSession(sessionConfiguration);
     browserSession.Visit("/");
     Assert.That(browserSession.HasContent("building web applications that work"));
 }
示例#8
0
 public void SetUp()
 {
     var configuration = new SessionConfiguration { Driver = typeof(SauceLabsDriver) };
     var desiredCapabilites = new DesiredCapabilities("chrome", "46", Platform.CurrentPlatform);
     desiredCapabilites.SetCapability("platform", "Windows 7");
     desiredCapabilites.SetCapability("username", "sebllabres");
     desiredCapabilites.SetCapability("accessKey", "892fdc2f-7409-4979-a592-e5e3d3ee73bc");
     desiredCapabilites.SetCapability("name", TestContext.CurrentContext.Test.Name);
     _driver = new SauceLabsDriver(Browser.Parse(ConfigurationSettings.AppSettings["browser"]), desiredCapabilites, new CustomRemoteDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), desiredCapabilites));
     _browserSession = new BrowserSession(configuration, _driver);
     _browserSession.MaximiseWindow();
 }
        public string GetFullyQualifiedUrl(string virtualPath, SessionConfiguration SessionConfiguration)
        {
            if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
                return virtualPath;

            virtualPath = virtualPath.TrimStart('/');
            var scheme = SessionConfiguration.SSL ? "https" : "http";

            return SessionConfiguration.Port == 80
                       ? String.Format("{0}://{1}/{2}", scheme, SessionConfiguration.AppHost, virtualPath)
                       : String.Format("{0}://{1}:{2}/{3}", scheme, SessionConfiguration.AppHost, SessionConfiguration.Port, virtualPath);
        }
示例#10
0
        public static void Start()
        {
            var sessionConfiguration = new SessionConfiguration
            {
                AppHost = "localhost/lateseats",
                Port = 80,
                Driver = typeof(SeleniumWebDriver)
            };
            Browser = new BrowserSession(sessionConfiguration);
            Browser.MaximiseWindow();

            ScenarioContext.Current.Add("Browser", Browser);
        }
示例#11
0
        private static BrowserSession CreateNewBrowserSession()
        {
            BrowserSession browser;

            var configuration =
                new SessionConfiguration
                    {
                        Timeout = TimeSpan.FromSeconds(TestSessionContext.Current.Configuration.TimeoutSeconds),
                        Browser = TestSessionContext.Current.Configuration.BrowserType,
                    };

            browser = new BrowserSession(configuration);
            return browser;
        }
示例#12
0
 public void BeforeScenario()
 {
     BrowserSession browserAtual;
     if (ScenarioContext.Current.TryGetValue<BrowserSession>(out browserAtual))
     {
         Browser = browserAtual;
         return;
     }
     var config = new SessionConfiguration { Port = CassiniDevConfig.PortaServidor,
         AppHost = "localhost",
         Browser = Coypu.Drivers.Browser.HtmlUnitWithJavaScript,
         Timeout = TimeSpan.FromSeconds(5),
         RetryInterval = TimeSpan.FromSeconds(0.1)};
     Browser = new BrowserSession(config);
     ScenarioContext.Current.Set<BrowserSession>(Browser);
 }
示例#13
0
 internal BrowserSession(
     SessionConfiguration sessionConfiguration,
     Driver driver,
     TimingStrategy timingStrategy,
     Waiter waiter,
     UrlBuilder urlBuilder,
     DisambiguationStrategy disambiguationStrategy,
     RestrictedResourceDownloader restrictedResourceDownloader
     )
     : base(sessionConfiguration,
       null,
       driver,
       timingStrategy,
       waiter,
       urlBuilder,
       disambiguationStrategy)
 {
     this.restrictedResourceDownloader = restrictedResourceDownloader;
 }
示例#14
0
 internal BrowserSession(
     SessionConfiguration sessionConfiguration,
     DriverFactory driverFactory,
     TimingStrategy timingStrategy,
     Waiter waiter,
     UrlBuilder urlBuilder,
     DisambiguationStrategy disambiguationStrategy,
     RestrictedResourceDownloader restrictedResourceDownloader
     )
     : base(
         sessionConfiguration,
         null,
         driverFactory.NewWebDriver(sessionConfiguration.Driver, sessionConfiguration.Browser),
         timingStrategy,
         waiter,
         urlBuilder,
         disambiguationStrategy
         )
 {
     this.restrictedResourceDownloader = restrictedResourceDownloader;
 }
示例#15
0
 internal BrowserWindow(SessionConfiguration SessionConfiguration, ElementFinder elementFinder, Driver driver, RobustWrapper robustWrapper, Waiter waiter, UrlBuilder urlBuilder)
     : base(SessionConfiguration, elementFinder, driver, robustWrapper, waiter, urlBuilder)
 {
 }
示例#16
0
 internal BrowserWindow(SessionConfiguration SessionConfiguration, ElementFinder elementFinder, Driver driver, TimingStrategy timingStrategy, Waiter waiter, UrlBuilder urlBuilder, DisambiguationStrategy disambiguationStrategy)
     : base(SessionConfiguration, elementFinder, driver, timingStrategy, waiter, urlBuilder, disambiguationStrategy)
 {
 }
示例#17
0
 internal BrowserSession(DriverFactory driver, SessionConfiguration SessionConfiguration, RobustWrapper robustWrapper, Waiter waiter, RestrictedResourceDownloader restrictedResourceDownloader, UrlBuilder urlBuilder)
     : base(SessionConfiguration, null, driver.NewWebDriver(SessionConfiguration.Driver, SessionConfiguration.Browser), robustWrapper, waiter, urlBuilder)
 {
     this.restrictedResourceDownloader = restrictedResourceDownloader;
 }
示例#18
0
 internal BrowserSession(DriverFactory driver, SessionConfiguration SessionConfiguration, RobustWrapper robustWrapper, Waiter waiter, RestrictedResourceDownloader restrictedResourceDownloader, UrlBuilder urlBuilder)
     : base(SessionConfiguration, null, driver.NewWebDriver(SessionConfiguration.Driver, SessionConfiguration.Browser), robustWrapper, waiter, urlBuilder)
 {
     this.restrictedResourceDownloader = restrictedResourceDownloader;
 }
示例#19
0
 internal RobustWindowScope(Driver driver, SessionConfiguration SessionConfiguration, RobustWrapper robustWrapper, Waiter waiter, UrlBuilder urlBuilder, Options options, WindowFinder windowFinder)
     : base(SessionConfiguration, windowFinder, driver, robustWrapper, waiter, urlBuilder)
 {
     this.options = options;
 }
示例#20
0
 internal BrowserSession(DriverFactory driver, SessionConfiguration SessionConfiguration, TimingStrategy timingStrategy, Waiter waiter, RestrictedResourceDownloader restrictedResourceDownloader, UrlBuilder urlBuilder, DisambiguationStrategy disambiguationStrategy)
     : base(SessionConfiguration, null, driver.NewWebDriver(SessionConfiguration.Driver, SessionConfiguration.Browser), timingStrategy, waiter, urlBuilder, disambiguationStrategy)
 {
     this.restrictedResourceDownloader = restrictedResourceDownloader;
 }
示例#21
0
 internal BrowserWindow(SessionConfiguration SessionConfiguration, ElementFinder elementFinder, Driver driver, TimingStrategy timingStrategy, Waiter waiter, UrlBuilder urlBuilder, DisambiguationStrategy disambiguationStrategy) 
     : base(SessionConfiguration, elementFinder, driver, timingStrategy, waiter, urlBuilder, disambiguationStrategy)
 {
 }
示例#22
0
 internal RobustWindowScope(Driver driver, SessionConfiguration SessionConfiguration, RobustWrapper robustWrapper, Waiter waiter, UrlBuilder urlBuilder, Options options, WindowFinder windowFinder)
     : base(SessionConfiguration,windowFinder,driver, robustWrapper, waiter, urlBuilder)
 {
     this.options = options;
 }
示例#23
0
 internal BrowserWindow(SessionConfiguration SessionConfiguration, ElementFinder elementFinder, Driver driver, RobustWrapper robustWrapper, Waiter waiter, UrlBuilder urlBuilder)
     : base(SessionConfiguration, elementFinder, driver, robustWrapper, waiter, urlBuilder)
 {
 }
示例#24
0
 public Hooks(SessionConfiguration sessionConfig, ZukiniConfiguration zukiniConfig)
 {
     _sessionConfiguration = sessionConfig;
     _zukiniConfiguration = zukiniConfig;
 }