/// <summary> /// Starts the command executor. /// </summary> public void Start() { this.server.Start(); string connectFileName = this.PrepareConnectFile(); this.LaunchSafariProcess(connectFileName); this.connection = this.server.WaitForConnection(TimeSpan.FromSeconds(45)); this.DeleteConnectFile(); if (this.connection == null) { throw new WebDriverException("Did not receive a connection from the Safari extension. Please verify that it is properly installed and is the proper version."); } }
/// <summary> /// Starts the server. /// </summary> public void Start() { this.webSocketServer.Start(); string connectFileName = this.PrepareConnectFile(); this.LaunchSafariProcess(connectFileName); this.connection = this.WaitForConnection(TimeSpan.FromSeconds(45)); this.DeleteConnectFile(); if (this.connection == null) { throw new WebDriverException("Did not receive a connection from the Safari extension. Please verify that it is properly installed and is the proper version."); } }
/// <summary> /// Waits for a connection to be established with the server by the Safari browser extension. /// </summary> /// <param name="timeout">A <see cref="TimeSpan"/> containing the amount of time to wait for the connection.</param> /// <returns>A <see cref="SafariDriverConnection"/> representing the connection to the browser.</returns> public SafariDriverConnection WaitForConnection(TimeSpan timeout) { SafariDriverConnection foundConnection = null; DateTime end = DateTime.Now.Add(timeout); while (this.connections.Count == 0 && DateTime.Now < end) { Thread.Sleep(250); } if (this.connections.Count > 0) { foundConnection = this.connections.Dequeue(); } return(foundConnection); }
/// <summary> /// Starts the command executor. /// </summary> public void Start() { this.server.Start(); string connectFileName = this.PrepareConnectFile(); this.LaunchSafariProcess(connectFileName); this.connection = this.server.WaitForConnection(TimeSpan.FromSeconds(45)); this.DeleteConnectFile(); }