Represents a session of an IWebDriver.
Example #1
0
        /// <summary>
        /// Creates a new session with the desired capabilities.
        /// </summary>
        /// <param name="desiredCapabilities">An <see cref="ICapabilities"/> object describing the desired capabilities of the session.</param>
        /// <returns>The <see cref="SessionId"/> of the created session.</returns>
        internal SessionId CreateSession(ICapabilities desiredCapabilities)
        {
            DriverSession newSession = new DriverSession(this.factory, desiredCapabilities);

            SessionId newSessionId = new SessionId(Guid.NewGuid().ToString());

            this.sessionDictionary.Add(newSessionId, newSession);
            return(newSessionId);
        }
Example #2
0
        /// <summary>
        /// Gets an existing session given the specified <see cref="SessionId"/>.
        /// </summary>
        /// <param name="sessionId">The <see cref="SessionId"/> identifying the session.</param>
        /// <returns>The <see cref="DriverSession"/> corresponding to the ID.</returns>
        internal DriverSession GetSession(SessionId sessionId)
        {
            DriverSession existingSession = null;

            if (this.SessionExists(sessionId))
            {
                existingSession = this.sessionDictionary[sessionId];
            }

            return(existingSession);
        }
Example #3
0
        /// <summary>
        /// Creates a new session with the desired capabilities.
        /// </summary>
        /// <param name="desiredCapabilities">An <see cref="ICapabilities"/> object describing the desired capabilities of the session.</param>
        /// <returns>The <see cref="SessionId"/> of the created session.</returns>
        internal SessionId CreateSession(ICapabilities desiredCapabilities)
        {
            DriverSession newSession = new DriverSession(this.factory, desiredCapabilities);

            SessionId newSessionId = new SessionId(Guid.NewGuid().ToString());
            this.sessionDictionary.Add(newSessionId, newSession);
            return newSessionId;
        }