OpenQA.Selenium.Remote.RemoteWebDriver.Execute C# (CSharp) Method

Execute() protected method

Executes a command with this driver .
protected Execute ( DriverCommand driverCommandToExecute, object>.Dictionary parameters ) : OpenQA.Selenium.Remote.Response
driverCommandToExecute DriverCommand A value representing the command to execute.
parameters object>.Dictionary A containing the names and values of the parameters of the command.
return OpenQA.Selenium.Remote.Response
        protected virtual Response Execute(DriverCommand driverCommandToExecute, Dictionary<string, object> parameters)
        {
            Command commandToExecute = new Command(this.sessionId, driverCommandToExecute, parameters);

            Response commandResponse = new Response();

            try
            {
                commandResponse = this.executor.Execute(commandToExecute);
            }
            catch (System.Net.WebException e)
            {
                commandResponse.Status = WebDriverResult.UnhandledError;
                commandResponse.Value = e;
            }

            if (commandResponse.Status != WebDriverResult.Success)
            {
                UnpackAndThrowOnError(commandResponse);
            }

            return commandResponse;
        }

Usage Example

Example #1
0
            /// <summary>
            /// Method for creating a cookie in the browser
            /// </summary>
            /// <param name="cookie"><see cref="Cookie"/> that represents a cookie in the browser</param>
            public void AddCookie(Cookie cookie)
            {
                Dictionary <string, object> parameters = new Dictionary <string, object>();

                parameters.Add("cookie", cookie);
                driver.Execute(DriverCommand.AddCookie, parameters);
            }
All Usage Examples Of OpenQA.Selenium.Remote.RemoteWebDriver::Execute