Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SafariDriverServer"/> class using the specified options.
        /// </summary>
        /// <param name="options">The <see cref="SafariOptions"/> defining the browser settings.</param>
        public SafariDriverServer(SafariOptions options)
        {
            int webSocketPort = options.Port;

            if (webSocketPort == 0)
            {
                webSocketPort = PortUtilities.FindFreePort();
            }

            this.webSocketServer         = new WebSocketServer(webSocketPort, "ws://localhost/wd");
            this.webSocketServer.Opened += new EventHandler <ConnectionEventArgs>(this.ServerOpenedEventHandler);
            this.webSocketServer.Closed += new EventHandler <ConnectionEventArgs>(this.ServerClosedEventHandler);
            this.webSocketServer.StandardHttpRequestReceived += new EventHandler <StandardHttpRequestReceivedEventArgs>(this.ServerStandardHttpRequestReceivedEventHandler);
            this.serverUri = new Uri(string.Format(CultureInfo.InvariantCulture, "http://localhost:{0}/", webSocketPort.ToString(CultureInfo.InvariantCulture)));
            if (string.IsNullOrEmpty(options.SafariLocation))
            {
                this.safariExecutableLocation = GetDefaultSafariLocation();
            }
            else
            {
                this.safariExecutableLocation = options.SafariLocation;
            }

            this.extension = new SafariDriverExtension(options.CustomExtensionPath, options.SkipExtensionInstallation);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SafariDriverCommandExecutor"/> class.
        /// </summary>
        /// <param name="options">The <see cref="SafariOptions"/> used to create the command executor.</param>
        public SafariDriverCommandExecutor(SafariOptions options)
        {
            this.server = new SafariDriverServer(options.Port);
            if (string.IsNullOrEmpty(options.SafariLocation))
            {
                this.safariExecutableLocation = GetDefaultSafariLocation();
            }
            else
            {
                this.safariExecutableLocation = options.SafariLocation;
            }

            this.extension = new SafariDriverExtension(options.CustomExtensionPath, options.SkipExtensionInstallation);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SafariDriverCommandExecutor"/> class.
        /// </summary>
        /// <param name="options">The <see cref="SafariOptions"/> used to create the command executor.</param>
        public SafariDriverCommandExecutor(SafariOptions options)
        {
            this.server = new SafariDriverServer(options.Port);
            if (string.IsNullOrEmpty(options.SafariLocation))
            {
                this.safariExecutableLocation = GetDefaultSafariLocation();
            }
            else
            {
                this.safariExecutableLocation = options.SafariLocation;
            }

            this.extension = new SafariDriverExtension(options.CustomExtensionPath, options.SkipExtensionInstallation);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SafariDriverServer"/> class using the specified options.
        /// </summary>
        /// <param name="options">The <see cref="SafariOptions"/> defining the browser settings.</param>
        public SafariDriverServer(SafariOptions options)
        {
            int webSocketPort = options.Port;
            if (webSocketPort == 0)
            {
                webSocketPort = PortUtilities.FindFreePort();
            }

            this.webSocketServer = new WebSocketServer(webSocketPort, "ws://localhost/wd");
            this.webSocketServer.Opened += new EventHandler<ConnectionEventArgs>(this.ServerOpenedEventHandler);
            this.webSocketServer.Closed += new EventHandler<ConnectionEventArgs>(this.ServerClosedEventHandler);
            this.webSocketServer.StandardHttpRequestReceived += new EventHandler<StandardHttpRequestReceivedEventArgs>(this.ServerStandardHttpRequestReceivedEventHandler);
            this.serverUri = new Uri(string.Format(CultureInfo.InvariantCulture, "http://localhost:{0}/", webSocketPort.ToString(CultureInfo.InvariantCulture)));
            if (string.IsNullOrEmpty(options.SafariLocation))
            {
                this.safariExecutableLocation = GetDefaultSafariLocation();
            }
            else
            {
                this.safariExecutableLocation = options.SafariLocation;
            }

            this.extension = new SafariDriverExtension(options.CustomExtensionPath, options.SkipExtensionInstallation);
        }