Ejemplo n.º 1
0
        public IBrowserHost CreateWithCapabilities(ICapabilities capabilities, BrowserConfiguration browserConfiguration = null)
        {
            var instance = CreateBrowserHost(browserConfiguration);

            instance.Run(CreateRemoteDriverWithCapabilities(capabilities),
                         CreateInternetWebServer(_configurationProvider.RemoteUrl));

            return(instance);
        }
Ejemplo n.º 2
0
        public virtual IBrowserHost CreateLocalWebDriver(BrowserEnum browser, BrowserConfiguration browserConfiguration = null)
        {
            var instance = CreateBrowserHost(browserConfiguration);

            instance.Configuration.IsLocalWebDriver = true;

            instance.Run(LocalWebBrowser(browser), CreateInternetWebServer(_configurationProvider.RemoteUrl));

            return(instance);
        }
Ejemplo n.º 3
0
        public IBrowserHost CreateAndConfigure(TestSpecification testSpecification, string browser = null)
        {
            var builder = _capabilitiesBuilder.WithTestSpecification(testSpecification);
            BrowserConfiguration browserConfiguration = null;

            if (browser != null)
            {
                browserConfiguration = _parser.Parse(browser);
                builder.WithBrowserConfiguration(browserConfiguration);
            }

            var capabilities = builder.WithRunTestLocally(_configurationProvider.RunTestLocally).Build();

            return(_configurationProvider.LocalBrowser.HasValue
                ? _browserHostFactory.CreateLocalWebDriver(_configurationProvider.LocalBrowser.Value, browserConfiguration)
                : _browserHostFactory.CreateWithCapabilities(capabilities, browserConfiguration));
        }
Ejemplo n.º 4
0
        public BrowserConfiguration Parse(string value)
        {
            bool isMobileDevice;
            var  parameters = ValidateAndExtractBrowserConfiguration(value, out isMobileDevice);
            BrowserConfiguration result;

            if (isMobileDevice)
            {
                result = new BrowserConfiguration(parameters[0], parameters[1].Replace(ItemSpaceSeparator, " "));
            }
            else if (parameters.Length == 1)
            {
                if (!IsNotDesktopResolution(parameters[0]))
                {
                    throw new InvalidBrowserConfigurationException("First and only parameter cannot be a desktop resolution");
                }
                result = new BrowserConfiguration(parameters[0]);
            }
            else if (parameters.Length >= 4)
            {
                result = new BrowserConfiguration(parameters[0], parameters[1],
                                                  parameters[2].Replace(ItemSpaceSeparator, " "),
                                                  parameters[3], ParseDesktopResolution(parameters));
            }
            else
            {
                result = new BrowserConfiguration(parameters[0], resolution: parameters[1]);
            }

            if (_browserStackService.IsNotSupported(result))
            {
                throw new UnsupportedBrowserException(result);
            }

            return(result);
        }
Ejemplo n.º 5
0
 internal virtual IBrowserHost CreateBrowserHost(BrowserConfiguration browserConfiguration)
 {
     return(new BrowserHost(new SelenoHost(), browserConfiguration));
 }
Ejemplo n.º 6
0
 public BrowserHost(SelenoHost selenoHost, BrowserConfiguration browserConfiguration = null)
 {
     _selenoHost   = selenoHost;
     Configuration = browserConfiguration ?? new BrowserConfiguration();
 }